duckdb / duckdb-java

DuckDB JDBC Driver
https://duckdb.org/docs/api/java.html
MIT License
42 stars 23 forks source link

Deadlock when opening a 2nd connection with an unclosed statement from previous connection #101

Open juja0 opened 1 month ago

juja0 commented 1 month ago

Not sure if this is expected behaviour but if a new connection is opened when a prior (closed) connection has an unclosed statement, the request hangs.

Properly closing all statements before closing connections seems to fix the deadlock.

Could potentially be related to the busy-wait added in this PR.

Wanted to check if it would be better to have a configurable timeout for the busy wait since the cause of deadlock may be hard to pin down when it hangs.

Sample repro: https://github.com/juja0/duckdb_deadlock