I am using repoze.zodbconn in a BFG application but I suspect it is not
working as it should be: as soon as multiple requests come in at the
same time I get a lot of locking errors and broken results:
LockError: Couldn't lock
The way I've setup repoze.zodbconn is
from repoze.zodbconn.finder import PersistentApplicationFinder
from myproject import appmaker
finder = PersistentApplicationFinder(settings["zodb.url"], appmaker)
the get_root method then serves as the root factory for BFG. What I
think is happening is that get_root is called for every request.
get_root then calls the PersistentApplicationFinder which tries to open
a new ZODB connection, which fails if another thread already has an open
connection to the same FileStorage.
What I think should be done is to open the ZODB connection on app
startup and only appmaker(conn.root90) per request. ZODB should then
care of per-thread connection management itself. I see no way to
accomplish that using the code in repoze.zodbconn, so I am wondering if
I missed something critical or if this is indeed a bug in repoze.zodbconn.
Repoze-dev mailing list