Don't report shutdown DB interrupts as processing errors#3441
Open
ouziel-slama wants to merge 2 commits into
Open
Don't report shutdown DB interrupts as processing errors#3441ouziel-slama wants to merge 2 commits into
ouziel-slama wants to merge 2 commits into
Conversation
When the server stops, RawMempoolParser.stop() calls db.interrupt() on the
connection shared with the BlockchainWatcher. If the watcher is mid-parse,
the in-flight SQLite query is aborted as apsw.InterruptError, surfacing as
ParseTransactionError("interrupted") in receive_multipart. This benign
teardown race was logged as an error, sent to Sentry, and re-raised to force
a "fail loud" restart of an already-stopping process.
Guard the handler with stop_event: during shutdown, log the interrupt at
debug and return quietly instead of paging Sentry. The fail-loud path is
preserved for genuine processing failures (stop_event not set).
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #3441 +/- ##
===========================================
- Coverage 91.38% 91.22% -0.17%
===========================================
Files 114 114
Lines 16296 16299 +3
===========================================
- Hits 14892 14868 -24
- Misses 1404 1431 +27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
adamkrellenstein
approved these changes
Jun 17, 2026
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.
Problem
Sentry issue API-SERVER-8G:
Error processing message: ParseTransactionError('interrupted')in production.ParseTransactionError('interrupted')is anapsw.InterruptError(whosestr()is exactly"interrupted") wrapped at blocks.py:260. It is triggered by adb.interrupt()that aborts an in-flight SQLite query.Chain
RawMempoolParsershares the same DB connection as the watcher (RawMempoolParser(self.db)).BlockchainWatcher.stop()→mempool_parser.stop()→db.interrupt()on that shared connection.receive_message(receive_rawblock/receive_rawtx→parse_tx), the query is aborted →InterruptError("interrupted")→ParseTransactionError("interrupted").receive_multipartlogged it as an error, sent it to Sentry, and re-raised to force a "fail loud" restart — of a process that was already stopping.This is benign teardown noise: no block/tx is corrupted (the supervisor restarts
catch_up()from scratch anyway).Fix
Guard the
receive_multipartexception handler withstop_event: during shutdown, log the interrupt atdebugand return quietly instead of paging Sentry / re-raising. The fail-loud path is preserved for genuine processing failures (whenstop_eventis not set).Tests
test_receive_multipart_swallows_interrupt_during_shutdown: withstop_eventset, aParseTransactionError("interrupted")is neither re-raised nor sent to Sentry.test_receive_multipart_message_processing_errorstill asserts the fail-loud re-raise when not shutting down.Release notes updated in
release-notes/release-notes-v11.1.1.md.