[Xapian-devel] xapian csharp bindings crash

Greg freediving at gmail.com
Tue Jun 28 19:09:42 BST 2011


On Tue, Jun 28, 2011 at 5:49 PM, Olly Betts <olly at survex.com> wrote:
>> ...
>> I've actually wondered about it myself but I thought that it was
>> called internally for some reason.
>No, nothing calls TermGenerator implicitly.

Which is extremely odd, the only explanation I can find would be that
the debugger (windbg) didn't interpret the exception stack trace
correctly.

>> using (var xdb = OpenQueryDatabase(DBtype.AutoCompleteThreads))
>
> Nothing looks obviously wrong here, but the mention of threads makes
> me wonder - are you perhaps sharing Xapian objects between threads?
> If so, it's your responsibility to ensure they aren't used from two
> different threads at once.  Either you need a mutex or similar, or
> just to use a different object in each thread.  Failing to do this
> can cause weird behaviour, which potentially fits with what you are
> seeing.

Nothing as sinister as that, the Threads reference in the name
actually relates to messages and threads of messages i.e. it's a forum
application. We're actually creating Xapian objects for every request
so they aren't shared (I'll double check with the OpenQueryDatabase
method), which is probably not the best of ideas in terms of
connections e.g. making some sort of a connection pooling class would
probably help but that's fluff at the moment.

And thank you very much for taking the time to answer my questions,
I'll keep this updated if I have any more news on the issue.



More information about the Xapian-devel mailing list