[Xapian-discuss] File descriptor leak (?) in Python

Olly Betts olly at survex.com
Mon Aug 9 15:17:07 BST 2010


On Mon, Aug 09, 2010 at 02:41:03PM +0200, Joost Cassee wrote:
> Recently I have upgraded a Python application from Xapian 1.0.7 to
> 1.2.2 in order to use the PostingSource class. It is a long-running
> process, and I am seeing the number of open file descriptors to the
> Xapian database steadily increase. I suspect what I am seeing is some
> kind of resource leak.

We have machinery to report leaked file descriptors in the xapian-core
testsuite on Linux and some other platforms, so if there is a leak at
the C++ level, it is in a case that isn't covered by the testsuite, or
which is specific to certain non-Linux platforms.  Or the fd leak checking
machinery doesn't work fully!

> I have no idea if it is a problem in our code or in the Xapian Python
> bindings. How do I debug this problem?

If you're on Linux (or another platform which supports it) try:

ls -l /proc/PID/fd

where PID is the process id of your Xapian-using Python process.  This
will show all the fds it has open, and which files they are, which should
provide a clue.

Cheers,
    Olly



More information about the Xapian-discuss mailing list