[New-bugs-announce] [issue13947] gdbm reorganize() leaves hanging file descriptor

Jack Miller report at bugs.python.org
Mon Feb 6 05:13:36 CET 2012

New submission from Jack Miller <jack at codezen.org>:

I've discovered that using either 2.7.2 or 3.2.2 (from Arch) reorganizing gdbm databases leave hanging file descriptors that will cause EAGAIN errors trying to reopen it until the process is killed. For example:

Python 2.7.2 (default, Jan 31 2012, 13:19:49) 
[GCC 4.6.2 20120120 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gdbm
>>> o = gdbm.open("test27", "c")
>>> o.reorganize()
>>> o.close()
>>> o = gdbm.open("test27", "w")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
gdbm.error: (11, 'Resource temporarily unavailable')

By using lsof you can see that after reorganize() test27 has two open file descriptors, and after close() one is still open with no (obvious) way to close it. This happens with freshly created and populated databases and regardless of open mode flags.

I also tested this on 3.2.2 with dbm.gnu and got identical behavior.

messages: 152719
nosy: themoken
priority: normal
severity: normal
status: open
title: gdbm reorganize() leaves hanging file descriptor
versions: Python 2.7, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list