[pybsddb] Strange replication bug

Doug Winter doug at isotoma.com
Sun Jun 15 16:53:18 CEST 2008


I've been doing some experimenting with replication, and I've come
across what I think is a really weird bug.

First, the test cases.  They run ok normally:

$ tar -zxf bsddb3-4.7.0.tar.gz
$ cd bsddb3-4.7.0/
$ python setup.py build
...
$ cd build/
$ cd lib.linux-i686-2.5/
$ python bsddb3/tests/test_all.py

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Berkeley DB 4.6.21: (September 27, 2007)
bsddb.db.version():   (4, 6, 21)
bsddb.db.__version__: 4.7.0
bsddb.db.cvsid:       $Id: _bsddb.c 464 2008-05-21 19:01:43Z jcea $
python version:       2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
My pid:               10178
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
..................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 290 tests in 23.535s

OK

So that's all good.

Now, edit bsddb3/tests/test_all.py and comment out all of the
test_modules from lines 108 to 127 EXCEPT for test_replication.

$ python bsddb3/tests/test_all.py

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Berkeley DB 4.6.21: (September 27, 2007)
bsddb.db.version():   (4, 6, 21)
bsddb.db.__version__: 4.7.0
bsddb.db.cvsid:       $Id: _bsddb.c 464 2008-05-21 19:01:43Z jcea $
python version:       2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]
My pid:               10437
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Segmentation fault

So, it looks as if the replication tests working depends on another test
having been previously run, which is a bit screwy.

After a lot of selective commenting and uncommenting, it looks like the
segfault can be avoided by including line 87 of
bsddb3/tests/test_compare.py and the lines it depends on.  This is a
call to bsddb3.db.DB.set_bt_compare, which seems like it should be
independent of anything to do with replication.

I've verified this with my own program, which is attached.  This is
based on the example given in the "Getting Started" replication guide.

Run this with, say:

./example1.py -H db2 -m localhost:2001 -o localhost:2000 -p 20 -n 2

And it works.  Comment out line 68 and it segfaults on running.

I hope that's enough to help you track it down.

Cheers,

Doug.

-- 
Isotoma, Open Source Software Consulting - http://www.isotoma.com
Tel: 01904 567349, Mobile: 07879 423002, Fax: 020 79006980
Postal Address: Tower House, Fishergate, York, YO10 4UA, UK
For secure communication, please use PGP Key ID 1024D/6973E2CF

Registered in England.  Company No 5171172.  VAT GB843570325.
Regd Office: 3&4 Park Court, Riccall Road, Escrick, York, YO19 6ED


-------------- next part --------------
A non-text attachment was scrubbed...
Name: example1.py
Type: text/x-python
Size: 3912 bytes
Desc: not available
URL: <https://mailman.jcea.es/pipermail/pybsddb/attachments/20080615/324b8a39/attachment.py>


More information about the pybsddb mailing list