Bug 482542 - Transaction with lock table statement causes a deadlock
Summary: Transaction with lock table statement causes a deadlock
Status: NEW
Alias: None
Product: Vertx
Classification: RT
Component: Platform (show other bugs)
Version: 3.0.0   Edit
Hardware: Macintosh Mac OS X
: P3 critical
Target Milestone: Unknown   Edit
Assignee: Vert-x Platform Bugzilla Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-18 18:01 EST by Gordon Roylance CLA
Modified: 2015-11-18 18:01 EST (History)
0 users

See Also:


Attachments
Test project that demonstrates the deadlock (433.97 KB, application/zip)
2015-11-18 18:01 EST, Gordon Roylance CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gordon Roylance CLA 2015-11-18 18:01:23 EST
Created attachment 258138 [details]
Test project that demonstrates the deadlock

In the testTransactionLocking.java file inside the attached test project, you can see the deadlock happen with two simultaneous transactions that call lock table within the transaction. 

If you comment out the lock table statement the two transactions work fine. If you change the verticle to a multi-threaded/worker verticle, change the iterations from 2 to 100 in the for loop, a deadlock will occur again. If you set the worker pool size to match the number of the max connection pool size, no deadlock will occur.

Incidentally, if you only change the connection pool to 1 and leave the verticle as an event-loop verticle, no deadlocking occurs.

Although, it's possible to avoid a deadlock situation through changing configuration, the bug that prevents the JDBCClient, running on an event-loop thread, to utilize the worker pool and connections properly should be fixed.