Fix statement timeout dropped when timer event subscription fails#223
Merged
SeanTAllen merged 1 commit intomainfrom Apr 15, 2026
Merged
Fix statement timeout dropped when timer event subscription fails#223SeanTAllen merged 1 commit intomainfrom
SeanTAllen merged 1 commit intomainfrom
Conversation
lori 0.14.1 replaces the silent-cancel behavior for user-timer ASIO event subscription failures with a new `_on_timer_failure` callback. Without an override, the driver would keep running an in-flight query unbounded by its configured statement timeout. Rearm the timer with the in-flight operation's original duration so a transient subscription failure (e.g. `ENOMEM` from `epoll_ctl`/`kevent`) no longer drops the timeout. Rearm is best-effort; if the rearm's own subscription fails, the timeout is still lost for that operation. Also override `_on_idle_timer_failure` with `_IllegalState()` — postgres never arms lori's idle timer, so the callback firing would indicate a contract violation. Closes #222
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.
lori 0.14.1 replaces its prior silent-cancel behavior for user-timer ASIO event subscription failures with a new
_on_timer_failurecallback. Without an override, the driver would keep running an in-flight query unbounded by its configured statement timeout. Rearm the timer with the in-flight operation's original duration so a transient subscription failure no longer drops the timeout. Rearm is best-effort; if the rearm's own subscription fails, the timeout is still lost for that operation._on_idle_timer_failureis overridden to panic — postgres never arms lori's idle timer, so the callback firing would indicate a contract violation.A test-only behavior
Session._test_trigger_on_timer_failuresimulates the callback for the newStatementTimeout/RearmOnTimerFailureunit test. Triggering an ASIO subscription failure organically requires kernel resource pressure, which isn't reachable from tests.Closes #222