473,758 Members | 5,909 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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='tes t_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_MPO OL)
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.ope n(dbname,dbenv= dbenv2)
try: .... dbenv2.close()
.... except db.DBError:
.... pass
.... else:
.... assert 0
....

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

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

Similar topics

0
1477
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 bsddb Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.3/bsddb/__init__.py", line 40, in ? import _bsddb ImportError: No module named _bsddb Where can I find this module, and how do I get it to...
6
2008
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 I was using Windows. So I uninstalled Python, downloaded the latest python 2.3 and compiled it from source. Now when I try to import bsddb, I get this error...... >>> import bsddb
0
1307
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 am trying to port a Python app to a pocket pc and python release for pocket pc does not have bsddb module. thanks
4
4488
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 standard library http://www.python.org/dev/doc/devel/lib/module-bsddb.html. There are tests for locking, transactions, join, etc. Is there some documentation anywhere? I could infer what I need from the tests but maybe there is already some...
8
2760
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. The question came up if this is by itself thread safe, if some two or more threads try to change these data types, are the C functions by themselves are "atomic" or can they
0
1342
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 newer python on the machine. python2.2, which came with Redhat ES, works fine, so I suppose I messed up the build. I much appreciate any insight in how to fix this.
0
1251
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: /Users/yi/Software/sage-1.4.1.2/local/lib/python2.5/bsddb/__init__.py in <module>() 49 from bsddb3.dbutils import DeadlockWrap as _DeadlockWrap 50 else: ---51 import _bsddb
1
1751
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 version mismatch error with bsddb and I can't access my database anymore I noticed in the 2.5.1 release notes: - fixed a bug with bsddb.DB.stat: the flags and txn keyword arguments were transposed.
2
1690
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 Type "help", "copyright", "credits" or "license" for more information.
0
9298
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10072
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9906
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9885
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2698
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.