fix: silence spurious "sending on a closed channel" error on MDBX shutdown#25
Merged
procdump merged 1 commit intoJul 9, 2026
Conversation
Contributor
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
…tdown The MDBX metrics thread was removed in #54 (f243308) but its shutdown channel was left behind: MdbxDatabase::new still made a sync_channel(0) and dropped the receiver at construction, keeping only shutdown_tx. On Drop, shutdown_tx.send(()) then hit an already-closed channel and logged an error on every clean shutdown. Comment out the leftover plumbing (mpsc/SyncSender import, shutdown_tx field, its construction, and the Drop body), keeping Drop as a documented no-op. Each site notes #54 and warns against re-enabling the send (errors) or retaining the rx (sync_channel(0).send() would block forever on drop). No behavior change beyond dropping the erroneous log line.
1ca2897 to
d2f380f
Compare
Contributor
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
1 similar comment
Contributor
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
Contributor
|
Claude encountered an error after 2s —— View job I'll analyze this and get back to you. |
kstoykov
approved these changes
Jul 9, 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
Every clean shutdown logged:
level=error target=rayls::mdbx message="Error while trying to send shutdown to MDBX metrics thread sending on a closed channel"
Root cause
The MDBX metrics thread was removed in #54 (
f243308), but its shutdownchannel was left behind.
MdbxDatabase::newstill created async_channel(0)and dropped the receiver at construction (
_rx), keeping onlyshutdown_tx.On
Drop,shutdown_tx.send(())then targeted an already-closed channel — soit failed and logged an error on every shutdown. Benign (there was no thread to
signal, nothing lost), just noisy and misleading.
Change
Comment out the leftover channel plumbing — the
mpsc/SyncSenderimport, theshutdown_txfield, its construction, and theDropbody — keeping theDropimpl as a documented no-op. Each site references #54 and warns against the two
wrong "fixes": re-enabling the send (errors as before) or retaining the rx
(
sync_channel(0).send()would then block forever on drop with no reader).No behavior change beyond removing the erroneous log line; builds clean with no
unused-import warnings.
Should we want the metrics thread back we can uncomment the channel signalization commented in this PR.