New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bsddb3 hash craps out with threads #38896
Comments
Richie Hindle presented something like the attached Traceback (most recent call last):
File "hammer.py", line 36, in ?
main()
File "hammer.py", line 33, in main
hammer(db)
File "hammer.py", line 15, in hammer
x = db[str(int(random.random() * 100000))]
File "C:\CODE\PYTHON\lib\bsddb\__init__.py", line 86,
in __getitem__
return self.db[key]
bsddb._db.DBRunRecoveryError: (-30982,
'DB_RUNRECOVERY: Fatal error, run database
recovery -- fatal region error detected; run recovery') Richie also reported "illegal operation" crashes on It's not clear whether a bsddb3 hash *can* be used |
Logged In: YES Minor correction: I'm on Plain Old Win98, not SE. For what it's worth, the script seems more often than not |
Logged In: YES i'll try and reproduce this. |
Logged In: YES Greg, any luck? We're starting to see the same error ("fatal |
Logged In: YES I'm running this test with CVS Python (built on 9/11/03) on |
Logged In: YES How does the bsddb wrapper achieve thread safety? I know very little about the wrapper or the underlying bsddb http://www.sleepycat.com/docs/ref/program/mt.html#2
This suggests that a call to a self->db->get() must process The bsddb wrapper releases the GIL before calling the |
Logged In: YES From what I got back from Sleepycat on this, I'm pretty sure the Is there some way for the old interface to create a default |
Logged In: YES The old bsddb interface compatibility code could be modified to use a |
Logged In: YES Are the DB_mapping methods only used the old interface? My |
Logged In: YES ah, Keith's response from sleepycat assumed that we were using the |
Logged In: YES In theory, yes, we could special case the bsddb stuff. However, |
Logged In: YES
But the low-level open() call isn't made with a DBEnv argument |
Logged In: YES I don't see Keith's response anywhere in this thread. Can |
Logged In: YES Jeremy, Keith's response is in the sleepy.txt file attached to |
Logged In: YES Looking at bsddb/init.py (where the old bsddb compatibility I definately see potential threading problems with the _DBWithCursor I've got to pop offline for a bit now but i'll try a hammer.py modified to PS keiths response is in the sleepycat.txt attachment if you open the |
Logged In: YES I don't want to sound like a broken record, but I will: Can |
Logged In: YES Sorry to muddy the waters, but I'm 99% sure that this |
Logged In: YES The sleepycat mails (there are two of them - Keith's is |
Logged In: YES I don't see any problem in _bsddb.c:_DB_put(), what memory |
Logged In: YES If hammer.py fails for you, please try this slightly modified |
Logged In: YES I just committed a change to bsddb/init.py (file rev 1.10) that adds the creation of a thread-safe DBEnv object for each hashopen, btopen or rnopen database. hammer.py has been running for 5 minutes on my linux/alpha system using BerkeleyDB 4.1.25. (admittedly my test is running on python 2.2.2, but as this isn't a python core related change i doubt that matters). After others have tested this on other platforms with success I believe we can close this bug. This patch would probably be good for python 2.3.2. |
Logged In: YES Could you check that it (and the test_bsddb3) works on As far as 2.3.2, I really really don't think it's appropriate to |
Logged In: YES About studly_hammer.py: [Skip Montanaro]
On Win98SE with current Python 2.3.1, it doesn't fail, but it Dumping
at the top of the hammer loop showed that the threads get Attaching to a debug-build Python from the debugger when a _BSDDB_D! __db_win32_mutex_lock + 134 bytes The main thread's stack shows _BSDDB_D! __db_win32_mutex_lock + 134 bytes The other threads are somewhere in the OS kernel and don't All in all, looks like it's simply deadlocked. |
Logged In: YES Running the original hammer.py under current CVS Python |
Logged In: YES Deadlocks only occurring under DOS-based "windows" btw, i'll give things a go on solaris later this week. if |
Logged In: YES anthony - if we don't put this patch into python 2.3.2, the |
Logged In: YES I'd be much happier with a documentation fix for 2.3.2. Note that when I said "fails to complete" on Solaris, I |
Logged In: YES Greg, I'm in a constant state of debugging (in other apps) IOW, unless there's a bug in Sleepycat's implementation of |
Logged In: YES I built from CVS head on a Solaris machine. bsddb.__version__ I don't know what to make of this. If others have some |
Logged In: YES Forgot to mention that without the DBEnv() object, it gets a |
Logged In: YES This is also showing up in Syncato Does anyone know of a reliable way to recover? Rick Bradley |
Logged In: YES if you believe your application is properly using BerkeleyDB |
Logged In: YES Sadly, I believe bsddb is working "as designed". Quoting "When the DB_INIT_LOCK flag is specified, it is usually So I dig into my bsddb build tree, and found bsddb._db.DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Obviously it is PITA to need to run an external daemon, and |
Logged In: YES The db_deadlock program ends up being equivalent to a thread For completeness, I attach deadlock_hammer.py - a version |
Logged In: YES oh good i see you already suggested the simple thread regardless a thread isn't needed. see dbenv.set_lk_detect which http://www.sleepycat.com/docs/api_c/env_set_lk_detect.html Just add e.set_lk_detect(db.DB_LOCK_DEFAULT) to That causes hammer.py to get DBLockDeadlockError exceptions The bsddb legacy interface in __init__.py could have all of |
Logged In: YES modifying bsddb/init.py to wrap all calls with |
Logged In: YES I've added the e.set_lk_detect(db.DB_LOCK_DEFAULT) To the _openDBEnv function so that at the very least the bad I'm trying to decide if doing all the DeadlockWrap wrapping |
Logged In: YES Fixed. I wrapped all DB calls in Lib/bsddb/init.py with python svn commit r46969 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: