-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crashes (possibly) due to concurrent access to bulkUpdateIndex and search #15
Comments
To clarify, I've also tried switching between |
It sounds like you have a slightly different use case than tested for, with searches executing outside the main thread. I'd have to look a bit more closely at the code to be sure, but I'm guessing that Is there any way for you to share a sample project that demonstrates the crash you're seeing? You seem to be able to reproduce it easily, is that true? It might be easy to fix the crash for your use case if I could reproduce what you're seeing. |
That does sound plausible. I'll put together a simplified project that exhibits the crash. |
Here's what I came up with: https://github.com/lkoskela/BRFullTextSearch-ThreadingSample It's not as simple as I hoped but it does eventually trigger the crash if you start the app in iOS Simulator and let it run for a minute or two. It generates random additions, removals and searches to an index. You can also tap on the view to trigger a search. |
…ause any concurrently executing searchers will have their IndexReader closed from under them. Instead rely on shared_ptr deallocation of the Searcher, which then calls close() in its destructor. See #15.
Glad to hear! I've merged the fixes in for the next release. |
Hi,
I'm getting crashes (EXC_CRASH with either SIGABRT or SIGSEGV or an EXC_BAD_ACCESS if the Xcode debugger is connected) from BRFullTextSearch inside
lucene::search::PrefixQuery::rewrite(lucene::index::IndexReader *)
orlucene::index::SegmentTermDocs::SegmentTermDocs(lucene::index::SegmentReader const *)
and I have a hunch that it might relate to threads and concurrent modification of the searcher/query objects while a search is being made.Here's what's happening:
[CLuceneSearchService bulkUpdateIndex:queue:finished:]
(apparently just having finished modifying the index and thus triggering a call toresetSearcher
in the UI thread)[CLuceneSearchService search:]
(apparently trying to read the index with aSegmentReader
)[CLuceneSearchService resetSearcher]
(apparently closing the sameSegmentReader
my search queue is using)The examples in README.md don't feature the use of
NSOperationQueue
ordispatch_async
andCLuceneSearchService.h
says that it "supports concurrent updates and queries across different threads", which makes me believe I should be fine doing what I'm doing, i.e. callingbulkUpdateIndexAndWait:error:
andsearch:
from anNSOperationQueue
but it would be really nice to get confirmation whether I'm trying to useCLuceneSearchService
in a way that's not at all intended.The text was updated successfully, but these errors were encountered: