Re: IndexReader.close() contract

2018-03-28 Thread Dawid Weiss
> Regarding your point about concurrent calls to close() and decref(), I don't > see how doClose() may be called twice. The `closed` boolean is only used to > make close() idempotent. Do I miss something? No, sorry -- you're right, too much looking at this. > It is just a practical thing for now

Re: IndexReader.close() contract

2018-03-28 Thread Robert Muir
On Wed, Mar 28, 2018 at 9:59 AM, Adrien Grand wrote: > I'd > still be interested in other opinions regarding whether it would be ok to > rely more on ByteBufferGuard to have exceptions rather than segfaults when > reading closed index inputs given that comments say it is only a best > effort. > I

Re: IndexReader.close() contract

2018-03-28 Thread Adrien Grand
I agree with your points in general. I didn't have the code available to check when I first replied but it looks like the error message from the index inputs would be ok if you keep using the reader in another thread. I'd still be interested in other opinions regarding whether it would be ok to rel

Re: IndexReader.close() contract

2018-03-28 Thread Dawid Weiss
Also applicable to the general discussion above -- just noticed that decRef is not synchronized and closed is a regular variable so doClose() can be called from both close and decRef under a race condition. I know ref counting is an "expert feature", but I think it could better agree with close(),

Re: IndexReader.close() contract

2018-03-28 Thread Dawid Weiss
Hi Adrien, > I'm afraid that always calling doClose would be problematic. If the reader > is used in another thread then files might get closed under the hood while a > search is being performed. Even if the guard that we added to MMapDirectory > would now prevent segfaults, users would get potent

Re: IndexReader.close() contract

2018-03-27 Thread Adrien Grand
I'm afraid that always calling doClose would be problematic. If the reader is used in another thread then files might get closed under the hood while a search is being performed. Even if the guard that we added to MMapDirectory would now prevent segfaults, users would get potentially confusing exce

IndexReader.close() contract

2018-03-27 Thread Dawid Weiss
I'm looking at IndexReader.close and keep wondering: /** * Closes files associated with this index. * Also saves any new deletions to disk. * No other methods should be called after this has been called. * @throws IOException if there is a low-level IO error */ @Override publi