-
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
Dead DB connection not picked up correctly #1695
Comments
This appears to be a bug in TinyTDS that should be filed upstream. I'm going to close this now. Please file an issue upstream (https://github.com/rails-sqlserver/tiny_tds/issues). If the TinyTDS maintainers respond that the current behavior is expected and not a bug (unlikely), then I can reopen this and add a workaround. |
Will do, thanx. |
@jeremyevans there's been no response, but I see the activerecord-sqlserver-adapter project has added a workaround: rails-sqlserver/activerecord-sqlserver-adapter#818 |
I don't want to add code like that to Sequel unless the TinyTDS developers confirm that the current TinyTDS behavior is desired and will not be fixed. |
A workaround extension until the issue is fixed upstream: # frozen_string_literal: true
module Sequel
module TinyTdsChecker
def disconnect_error?(exception, opts)
super ||
((exception.is_a?(NoMethodError) && /\A(undefined method `each' for false:FalseClass)/.match(exception.message))) ||
((exception.is_a?(Sequel::DatabaseDisconnectError) && /\A(DBPROCESS is dead or not enabled|Write to the server failed)/.match(exception.message)))
end
end
Sequel::Database.register_extension(:tiny_tds_checker, Sequel::TinyTdsChecker)
end |
@jeremyevans digging up old cows here, but the extension I posted above stopped working (or never worked at all?). The extension gets registered, but the |
tiny_tds still hasn't fixed the upstream bug resulting in the In terms of the extension, it's only going to be called if you do |
@jeremyevans I do the required |
Complete Description of Issue
When a system sits idle for long, the first couple of queries fail with the error posted below. It looks like the TinyTDS adapter doesn't recognize the dead connection properly. A previous fix for this was attempted in this commit, but it doesn't seem to have fixed it.
Simplest Possible Self-Contained Example Showing the Bug
Full Backtrace of Exception (if any)
SQL Log (if any)
The text was updated successfully, but these errors were encountered: