Repository navigation
fix(events): raise a database outage from record_queued_in - #78
Conversation
A lost connection during the savepoint write of the queued event-log row was logged and swallowed, but the producer's transaction was gone with the connection, so its commit raised PendingRollbackError, which hosts cannot tell from a bug. An error is_database_unavailable reports is now raised as itself; other event-log errors are still swallowed. Release 0.24.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
What does this PR do?
EventLogRecorder.record_queued_inwrites the durablequeuedevent-log row on the producer's session, inside a savepoint. It logged and swallowed every error, including a lost connection.The savepoint protects the producer's transaction from a bad event-log write, but not from losing the connection. When PostgreSQL reset the connection mid-write:
OperationalErrorwas logged as a warning and swallowed.PendingRollbackError.is_database_unavailablereturns false forPendingRollbackError, so a host can't tell it from a bug. Endurain answered 500 with an ERROR log where every other request hit by the same reset got a 503. The Endurain load test'spostgres_faultsscenario found this on 0.24.0.Now, when
is_database_unavailableis true for the error,record_queued_inre-raises it.publish_committing,publish_on_commitand their batch forms then raise the originalOperationalError, which hosts already treat as an outage. Any other event-log error is still logged and swallowed.publishwith adbstill logs and swallows the error, as documented.This PR also releases 0.24.1. The version is bumped in
pyproject.toml,uv.lock,README.mdanddocs/index.md, with aCHANGELOG.mdentry.Related issue
None is open. This comes from an Endurain load-test hand-off.
Type of change
Checklist
Notes for the reviewer
OperationalErroron thejasil_event_loginsert. Ahandle_errorhook marks it as a disconnect, so SQLAlchemy wraps it and invalidates the connection the way it does for a real reset. It should work on every database in the CI matrix. Without the fix, it reproduces the reported sequence: a warning, thenPendingRollbackErroron the caller's commit.Ran locally on SQLite:
ruff check,ruff format --check,lint-imports,mypy,pytest(4,364 passed, 149 skipped, coverage 97.95%),check_module_coverage.pyandcheck_docs_api.py. The version bump came after that run.uv lock --checkpassed on the bumped version.🤖 Generated with Claude Code
Summary by CodeRabbit