Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.0: JDBC connections sharing task-queue, leading to client-side deadlock #203

Open
mwm-twx opened this issue Jan 19, 2021 · 2 comments
Open
Labels

Comments

@mwm-twx
Copy link

mwm-twx commented Jan 19, 2021

Version

4.0.0

Context

Application code which worked without issue on 3.9.x leads to a (non-database) deadlock on 4.0.0.

This is the scenario:

  1. Concurrent requests to the application which execute a number of database statements within transactions.
  2. The first request starts a transaction and adds an entry to table1
  3. Second request starts a transaction and attempts to add an entry to table1, but is due to the first requests transaction having locked the row
  4. First request attempts to add a row to table2, within the same transaction.

Each database action is handled within vertx as a blocking operation (JDBCConnectionImpl.schedule), so after the add to table1 completes, the add from the second request is executed. Since the table is locked by the transaction from the first request, which still has work to do, the second add will never return. Additional debugging shows the instances of JDBCConnectionImpl are operating over the same context (an EventLoopContext), so they shared the same ordered task queue.

In 3.9.x, each JDBCConnectionImpl had it's own TaskQueue, so operations from different connections were never interleaved.

Do you have a reproducer?

It will occur every time with my application code, but I don't have a shareable minimal case.

@mwm-twx mwm-twx added the bug label Jan 19, 2021
@Gattag
Copy link

Gattag commented Feb 5, 2021

From my understanding, the usage of TaskQueue was placed behind DuplicatedContext, now when you call ContextInternal::duplicate a new DuplicatedContext is returned with its own TaskQueue for blocking tasks, but it is otherwise near identical to the parent Context. I think the problem may lie in the fact that I do not see the DuplicatedContext per connection being created anywhere, thus they all end up sharing the same TaskQueue.

@vietj
Copy link
Contributor

vietj commented Feb 5, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants