This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: __del__ in dumbdbm fails under some circumstances
Type: Stage:
Components: Library (Lib) Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: rhettinger, tim.peters, timstone4
Priority: high Keywords: patch

Created on 2003-04-17 17:02 by timstone4, last changed 2022-04-10 16:08 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
patch.diff timstone4, 2003-04-17 17:02 Simple test for valid _os
Messages (4)
msg43397 - (view) Author: Tim Stone (timstone4) Date: 2003-04-17 17:02
Using dumbdbm for simple testing, I occasionally get the following 
error:

Exception exceptions.AttributeError: "'NoneType' 
object has no attribute 'error'
" in <bound method 
_Database.__del__ of <dumbdbm._Database instance at 
0x008B356
8>> ignored

I've tracked it down to a 
problem with the releasing of the reference to _os during __del__, 
which then calls _commit.  _commit proceeds to use the _os, 
which is given a value of None... blamo...
msg43398 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2003-07-13 01:37
Logged In: YES 
user_id=80475

Tim, did you see this during your review of dumbdbm?
msg43399 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-07-13 01:53
Logged In: YES 
user_id=31435

I didn't pay attention to it, but it is an obvious shutdown 
race.  I'll fix it.  Tim Stone (the OP) is a contributor to the 
spambayes project, and it turns out this is damned important 
in spambayes, because it appears the spambayes code never 
calls the dumbdbm.close() method explicitly.  Something else I 
learned from the dumbdbm review is that a dumbdbm's disk 
files routinely get out of synch with each other, and rely on 
someone calling close() or __del__() to get them back in 
synch.  If a .bak file doesn't already exist, though, this 
shutdown race can prevent __del__() from synch'ing the files.

Boosted priority.
msg43400 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2003-07-13 02:23
Logged In: YES 
user_id=31435

Fixed, in

Lib/dumbdbm.py; rev 1.26
Misc/NEWS; rev 1.810
History
Date User Action Args
2022-04-10 16:08:11adminsetgithub: 38320
2003-04-17 17:02:09timstone4create