[Xapian-discuss] thread locked while flushing to database

Olly Betts olly at survex.com
Tue Aug 17 15:12:52 BST 2010


On Thu, Aug 12, 2010 at 10:53:29AM +0100, William Crawford wrote:
> On Thursday 12 August 2010 09:53:42 Luca Barbieri wrote:
> 
> > Here are some details, strace outpud, gdb output, and top results:
> > http://pastebin.com/udGQTi6K
> 
> The output shows the other thread is blocked trying to call a thread library
> function (pthread_setcanceltype) from the bowels of libstdc++. While this
> could be a Xapian bug at heart, it's not obvious without seeing more code
> what could be causing this (it's basically a threading deadlock of some
> sort).

It looks like one thread is calling new and the other delete - I guess in the
libstdc++ allocator there's a lock of some sort.

There's no thread specific code in Xapian (on Linux at least - the remote
backend on Microsoft Windows uses a thread internally for something).  We
take care to avoid global mutable data, and so everything should work if
you don't share objects between threads, or protect accesses with a lock if you
do.

I'm not sure what's going on - all I can really suggest is the usual debugging
technique of trying to simplify the situation.  For example, what happens if
you don't set the thread affinity?

Cheers,
    Olly



More information about the Xapian-discuss mailing list