aws / aws-advanced-jdbc-wrapper

The Amazon Web Services JDBC Driver has been redesigned as an advanced JDBC wrapper. This wrapper is complementary to and extends the functionality of an existing JDBC driver to help an application take advantage of the features of clustered databases such as Amazon Aurora.
Apache License 2.0
205 stars 40 forks source link

Virtual Threads compatibility #1024

Open lazystone opened 3 months ago

lazystone commented 3 months ago

Describe the issue

Please explain your compatibility with virtual threads explicitly.

Original postgresql jdbc driver did a great job by replacing all "synchronized" by ReentrantLock(see v42.6.0 release notes), but in this wrapper there are a lot of "synchronized" places in the code.

Using "synchronized" causes thread pinning and can cause a dead-lock on Virtual Threads.

Links

https://github.com/pgjdbc/pgjdbc/releases/tag/REL42.6.0

aaronchung-bitquill commented 3 months ago

Hi @lazystone

Thanks for reaching out and raising this issue with us. We've updated our documentation to reflect this. We'll also be reviewing our usage of synchronized and concurrent classes that use synchronized, but cannot comment on any timelines.

Thank you!

rmichela commented 1 week ago

I've found 11 instances of synchronized in the code that interfere with virtual threads. Can these be replaced soon?

https://github.com/search?q=repo%3Aaws%2Faws-advanced-jdbc-wrapper+synchronized+language%3AJava&type=code&l=Java

aaronchung-bitquill commented 5 days ago

Hi @rmichela Thanks for reaching out. We are currently working on the drivers compatibility with virtual threads. We'll keep you updated when the change is available. Thank you!

sergiyvamz commented 1 day ago

Hi, @lazystone @rmichela

The issue has been fixed and we see no thread pinning. A fix is available in a snapshot build. Could you kindly checkout our snapshot build and let us know if the issue still persists?

https://github.com/aws/aws-advanced-jdbc-wrapper/blob/main/docs/using-the-jdbc-driver/UsingTheJdbcDriver.md#using-a-snapshot-of-the-driver

Thank you!