db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaasjan Brand <klaasjan.br...@topicus.nl>
Subject deadlock in sequenceManagerHighLowImpl (reopen OJB125?)
Date Thu, 03 Apr 2003 12:40:26 GMT

We've encountered the following deadlock with current OJB versions
(including current CVS):

In the class SequenceManagerHighLowImpl.getSequence(PersistenceBroker
brokerForSequence, FieldDescriptor field, String sequenceName)

According to this comment:
we use a new internBroker instance, because we run into problems
when current internBroker was rollback, then we have new sequence
in memory, but not in database and a concurrent thread will
get the same sequence.
Thus we use a new internBroker instance (with new connection) to
avoid this problem.

But because of this creating a new broker will create a new connection
for getting the sequence number. On a loaded site it's possible for the
connection pool to temporarily run out of connections.

In our case: A DListEntry is being filled by a
PersistenceBroker.getCollectionByQuery() that does have a connection of
its own. The new DlistEntry does a call to the
SequenceManagerHighLowImpl.getUniqueLong(FieldDescriptor) to get a
unique ID.
That method contains a synchronized(sequencesMap) part.
In this synchronize block it calls getSequence, which creates a new
That new persistenceBroker will try to get a new connection from the
pool. But if the pool is exhausted then it will block there.

Then every other call to the sequenceManager (which already holds a
connection) will block on the synchronize(sequenceMap)!

This looks very much like the recently closed bug OJB125, but it's
present in the current version,.

Anyone got an idea how to fix this?

Klaasjan Brand <klaasjan.brand@topicus.nl>
Topicus B.V.

View raw message