Use TinyTDS Client#ping in active? when available - #1412
Draft
emailrhoads wants to merge 4 commits into
Draft
emailrhoads wants to merge 4 commits into
emailrhoads wants to merge 4 commits into
Conversation
Idle RST leaves FreeTDS dbdead/active? stale-true until I/O fails. When TinyTDS provides Client#ping (rails-sqlserver/tiny_tds#609), call it from active? with a short FreeTDS-bounded timeout (config :ping_timeout, default 2s). Older TinyTDS keeps the passive active? path. Related to activerecord-sqlserver-adapter#1396. Co-authored-by: Cursor <cursoragent@cursor.com>
Explicit zero must not fall through to the default; use the passive active? path when ping is disabled or unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
emailrhoads
marked this pull request as draft
September 16, 2026 18:10
Co-authored-by: Cursor <cursoragent@cursor.com>
2 tasks
emailrhoads
marked this pull request as ready for review
September 16, 2026 18:17
emailrhoads
marked this pull request as draft
September 16, 2026 18:20
Author
|
Tracking issue: #1413 |
Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#ping,SQLServerAdapter#active?uses a FreeTDS-bounded liveness round-trip (:ping_timeout, default 2 seconds) instead of relying only on passivedbdead/active?.:ping_timeoutto0to disable the checkout ping and keep the passive path.@raw_connection.active?on TinyTDS builds without#ping.Depends on / follows tiny_tds#609, which adds
Client#ping(timeout:)+query_timeout=. This is the adapter-side policy for the checkout-liveness discussion in #1396: the driver owns the short-timeout probe; the adapter chooses to call it fromactive?(used by Rails 8verify!).This adapter used to do a live wellness check before #1121 (Oct 2023, “Removed legacy connection handling”),
active?ranraw_connection_do "SELECT 1". That PR switched to TinyTDS’s passiveactive?/ FreeTDSdbdead, which only flips after a failed I/O and therefore cannot detect an idle TCP RST (the peer closes the socket while the client still thinks the session is fine).This restores checkout liveness in the spirit of the pre-#1121
SELECT 1and of other adapters, without hanging on the connection’s timeout value, which may be much larger than is appropriate for this simple ping.