[Xapian-discuss] weird xapian problem: xapian 100% cpu for a minute, "unknown exception" later

Agustín agustinf at avature.net
Tue May 13 03:36:59 BST 2008

Hi all,

I've been working with xapian in php to index and search resumes and I
started having very unpredictable errors while running our unit tests.

I've finally been able to reproduce it reliably, in general terms:

1. create a new db
2. add 4 documents with a specific indexed text 
3. delete the last document

At that point php hangs using 100% cpu, eventually (about a minute or 2
later, I haven't measured) raising the php exception:

PHP Fatal error: Uncaught exception 'Exception' with message 'unknown
error in Xapian' in /usr/share/php5/xapian.php line 1148 Stack trace: 

#0 /usr/share/php5/xapian.php line 1148:
writabledatabase_replace_document(Resource id #5, 'sampleId',

I uploaded a testcase to:


I'm using php5-xapian in ubuntu, from your apt repository.

The version I have is 1.0.5-1.99gutsy (which is not the latest, I was
going to compile it from source to see if the problem is fixed in the
latest release.)

I tested it with the version from ubuntu (1.0.2 I think) and it doesn't
fail with the testcase, but I've seen it fail very seldomly.

Changing many things make the test not break:

1. Removing words from the text (well, sometimes you can find certain
parts which you can remove without making it fail).

2. Adding many words to the text.

3. Changing the order of the added documents.

4. Deleting any of the other documents before deleting the one which

Surprisingly, this things don't affect it much:

1. joining many of the words by removing whitespace between them.

2. replacing words with new ones which are of equal length or bigger.

3. whitespace, symbols, etc.

4. Adding more documents before deleting the last one.

Also, I know the testcase failed for me with ubuntu 7.10 and ubuntu

Any idea of what could help?


. A .

More information about the Xapian-discuss mailing list