Setup: jboss as 6, latest modeshape.
Started 30 requests in parallel in got stuck (nothing is happening)
Taking a threads dump and looking at the code, it seems to me that we have a race condition in RepositoryConnectionPool.
When we try to get a connection we do first (only the interesting part is shown):
The race condition is between the 'peek' and the 'take'.
Reason is further down the same method we do:
So we call 'take' here without holding the mainLock.
And this is IMO what happened.
I have a thread that is blocked in the first 'take' (after the 'peek') and another one that is stuck while trying to get the lock after calling 'take'.
This is this 'take' that went between the 'peek' and the 'take'.
Note I have 9 other threads that are trying to release the connections but are also blocked was tryng to get the lock and
this also explains why the first thread is stuck in 'take' as all the connections are taken.