473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

bsddb module bug?: doesn't release locks and seg faults

There is a test code named test_env_close in bsddb/test, but it
doesn't test the case thoroughly. There seems to be a bug in closing
the db environment first -- the lock is not released, and sometimes it
seg-faults.

Following is the code that shows this bug.

<code>
import os
from bsddb import db

dir,dbname='test_dbenv','test_db'

def getDbEnv(dir):
try:
os.mkdir(dir)
except:
pass
dbenv = db.DBEnv()
dbenv.open(dir, db.DB_INIT_CDB| db.DB_CREATE |db.DB_INIT_MPOOL)
return dbenv

def getDbHandler(db_env,db_name):
d = db.DB(dbenv)
d.open(db_name, db.DB_BTREE, db.DB_CREATE)
return d

dbenv=getDbEnv(dir)
assert dbenv.lock_stat()['nlocks']==0
d=getDbHandler(dbenv,dbname)
assert dbenv.lock_stat()['nlocks']==1
try:
dbenv.close()
except db.DBError:
pass
else:
assert 0

del d
import gc
gc.collect()
dbenv=getDbEnv(dir)
assert dbenv.lock_stat()['nlocks']==0,'number of current locks should
be 0' #this fails
</code>

If you close dbenv before db handler, the lock is not released.
Moreover, try this with dbshelve and it segfaults.

<code>
from bsddb import dbshelve
dbenv2=getDbEnv('test_dbenv2')
d2=dbshelve.open(dbname,dbenv=dbenv2)
try: .... dbenv2.close()
.... except db.DBError:
.... pass
.... else:
.... assert 0
....

Exception bsddb._db.DBError: (0, 'DBEnv object has been closed') in
Segmentation fault
</code>
Jul 18 '05 #1
0 1504

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John D. | last post by:
We are using OpenBSD latest release of Python (2.3), and want to use the "bsddb" module. Our python release has a directory called "bsddb", but when we try and import it, it says >>> import...
6
by: Dfenestr8 | last post by:
I started off trying to use bsddb with my standard mandrake 9 python 2.2.1 package. The shell reported back no such module. Strange, thinks I. I thought it was standard in the package, it was when...
0
by: Ajay Brar | last post by:
hi! when i do an import bsddb, it tries do do an import _bsddb i looked around Python23\Lib but couldn't find any _bsddp file....or am i totally on the wrong track. the reason i am asking is, i...
4
by: Michele Simionato | last post by:
I was browsing through the source tree of Python 2.4b2 and in Lib/bsddb/test I found a lot of interesting stuff. It seems that the support for the bsd database is much better than documented in the...
8
by: Torsten Mohr | last post by:
Hi, i write an extension module in C at the moment. This module does some work on some own data types that consist of some values. The functions that can change the data are written in C. ...
0
by: Barry | last post by:
I have python2.4.1 installed on two machines: -- one is Fedora core 1, where the bsddb module works fine -- one is Redhat ES 3.0, and I installed mysql 4.1 (and mysql-python2.1) after putting the...
0
by: Yi Qiang | last post by:
Hi guys, I am trying to compile python 2.5 on my OSX machine so it includes the bsddb module. Currently, when I type 'import bsddb' I get the following traceback: ...
1
by: BjornT | last post by:
Have a rather big problem with bsddb I can't figure out. I upgraded an Ubuntu machine from 7.05 to 7.10 which upgraded python to 2.5.1 I run a local website that uses bsddb, and suddenly I get a...
2
by: cocobear | last post by:
How to deal with multiple databases in an file. I want to get the content of several databases. it's the code I wrote: $ python Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11) on linux2...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.