Bug 306 : SequenceIdGenerator should use connection from current transaction instead of getting new one from datasource because of deadlock possibility
Priority 
High
Reported Version 
 
Logged By 
wInuX
Status 
Fixed
Fixed Version 
2.7.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
05/06/2010
Updated 
05/06/2010
Type 
Bug
 
Attachments 
No attachments

In multithread environment where number of concurrent threads are larger than maximum number of connection and waitTimeout is set to pessimistic time (E.G. 5 miutes) follow situation may occurs

1. Couple of thread starts transaction those exausting connection pool. Other threads are waiting for them to start they own transaction.
2. Every thread that was able to start transaction trying to save new entity with sequence generator.
3. SequenceGenerator asking DataSource for new connection but connection pool has already exausted.
4. Deadlock.

 
Rob 07 Jun 04:20
Fixed in HEAD

Fixed in HEAD.

Will use the Connection from the current transaction.

Refer:
- SequenceIdGenerator.nextId()
- DefaultPersister.setIdGenValue()

woResponse

Upload a file