-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
adapter/jdbc does not reconnect when DB2 "SqlNonTransientConnectionException" is raised #2083
Comments
Thanks for the report. I'll look into this right away. |
I pushed a fix, can you test the master branch and confirm whether it fixes the issue for you? I didn't make a change to the generic jdbc adapter, because I found this issue occurs both for the ibmdb adapter and the jdbc/db2, so I handled it in the shared DB2 support. I think the change you are proposing for the generic jdbc adapter makes sense though, but I'll probably wait on that until next week. |
Hi @jeremyevans! Thank you very much for your quick response and fix! |
This commit updated the sequel gem version to >= 5.73.0. The ibmdb and jdbc/db2 adapters were fixed to properly handle disconnect errors, removing the related connection from the pool (jeremyevans/sequel#2083)
Complete Description of Issue
Sequel is not reconnecting when a JDBC DB2
SqlNonTransientConnectionException
is raised. Instead, it maintains the stale connection in the pool, trying to reuse it indeterminately.The problem seems to be on the adapters/jdbc#disconnect_error? method. This specific exception is not being wrapped into another exception, letting the
:cause
nil.Changing it to the following solved the problem, as the actual disconnection error is thrown and is available on the
exception
variable.I didn't test it using other JDBC drivers, but I think it might be affecting others as well, depending on how those exceptions are being raised.
The
:connection_validator
extension can be used as a workaround, but I believe those disconnections should be handled by default.Steps to reproduce
1 - Run the example code
2- While running, kill the DB connection
Thank you!
Simplest Possible Self-Contained Example Showing the Bug
Full Backtrace of Exception (if any)
No response
SQL Log (if any)
No response
Ruby Version
No response
Sequel Version
5.71.0
The text was updated successfully, but these errors were encountered: