Skip to content

Fix statement timeout dropped when timer event subscription fails#223

Merged
SeanTAllen merged 1 commit intomainfrom
upgrade-lori-0.14.1
Apr 15, 2026
Merged

Fix statement timeout dropped when timer event subscription fails#223
SeanTAllen merged 1 commit intomainfrom
upgrade-lori-0.14.1

Conversation

@SeanTAllen
Copy link
Copy Markdown
Member

lori 0.14.1 replaces its prior 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 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_failure is 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_failure simulates the callback for the new StatementTimeout/RearmOnTimerFailure unit test. Triggering an ASIO subscription failure organically requires kernel resource pressure, which isn't reachable from tests.

Closes #222

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
@SeanTAllen SeanTAllen added the changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge label Apr 15, 2026
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Apr 15, 2026
@SeanTAllen SeanTAllen merged commit 0b05e4b into main Apr 15, 2026
11 checks passed
@SeanTAllen SeanTAllen deleted the upgrade-lori-0.14.1 branch April 15, 2026 00:58
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Apr 15, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 15, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog - fixed Automatically add "Fixed" CHANGELOG entry on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade to lori 0.14.1; handle new timer failure callbacks

2 participants