Skip to content

fix: silence spurious "sending on a closed channel" error on MDBX shutdown#25

Merged
procdump merged 1 commit into
raylsnetwork:mainfrom
procdump:fix/mdbx-false-erroring-for-inexisting-metrics-thread-shutdown
Jul 9, 2026
Merged

fix: silence spurious "sending on a closed channel" error on MDBX shutdown#25
procdump merged 1 commit into
raylsnetwork:mainfrom
procdump:fix/mdbx-false-erroring-for-inexisting-metrics-thread-shutdown

Conversation

@procdump

@procdump procdump commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

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 shutdown
channel was left behind. MdbxDatabase::new still created a sync_channel(0)
and dropped the receiver at construction (_rx), keeping only shutdown_tx.
On Drop, shutdown_tx.send(()) then targeted an already-closed channel — so
it 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/SyncSender import, the
shutdown_tx field, its construction, and the Drop body — keeping the Drop
impl 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.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
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.
@procdump procdump force-pushed the fix/mdbx-false-erroring-for-inexisting-metrics-thread-shutdown branch from 1ca2897 to d2f380f Compare July 9, 2026 13:33
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

1 similar comment
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@procdump procdump marked this pull request as ready for review July 9, 2026 13:37
@procdump procdump requested review from bronxyz and kstoykov as code owners July 9, 2026 13:37
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@procdump procdump merged commit 4ffe481 into raylsnetwork:main Jul 9, 2026
13 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants