[Xapian-discuss] Terminating a Xapian query

James Aylett james-xapian at tartarus.org
Fri Sep 25 16:24:02 BST 2009


On Fri, Sep 25, 2009 at 04:19:39PM +0100, Olly Betts wrote:

> If you just kill the thread, you're likely to leak memory.  The same
> goes if you try to use alarm(), setjmp() and longjmp() for similar
> reasons, but you can probably manage to close the database if you scope
> the jump correctly, so no fd leaks.

I was actually thinking of having the database held open by another
thread, so the searching thread is never responsible for its final
destruction.

> I think the best current approach would be to run the search in a child
> process.  You could achieve this without having to write much code if
> you run the search using the remote backend and xapian-progsrv.  If you
> only have one database and it is remote, recent versions of Xapian just
> run the match remotely and then serialise the results across the link,
> so you only add a small overhead.  The bit I can't see how to cleanly
> implement is finding the pid of the xapian-progsrv so you can kill it...

progsrv will have to be started by something, won't it?

J

-- 
  James Aylett

  talktorex.co.uk - xapian.org - uncertaintydivision.org



More information about the Xapian-discuss mailing list