bsddb3 thread problem

Nick Craig-Wood nick at craig-wood.com
Wed Apr 2 04:30:03 EDT 2008


anuraguniyal at yahoo.com <anuraguniyal at yahoo.com> wrote:
> 
> > Using threads with bsddb3.  I spent weeks trying to get it to behave
> > when threading.  I gave up in the end and changed to sqlite :-(
> >
>  So does it mean that I will have to use threading locks around access
>  methods? or that will also fail mysteriously :)

In theory bsddb is thread safe if you pass the right flags into the
constructor.

In practice I had to read the source code of the python interface to
work out what flags I was supposed to be passing at all and I'm not
convinced I ever got them right.  It is really quite confusing the way
bsddb objects get constructed!

In practice bdsdb just locked up and crashed in lots of odd ways when
I abused it with threads, whereas sqlite gave me nice error messages
saying something like "you made this handle in thread X but now you
are trying to use it in thread Y which won't work".

You can probably make bsddb work with threads, but I wasted too much
time trying without success!

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list