Skip to content

Refactor stratum server leak handling - #3876

Open
syntaxjak wants to merge 13 commits into
mimblewimble:stagingfrom
syntaxjak:fix-stratum-leaks
Open

Refactor stratum server leak handling#3876
syntaxjak wants to merge 13 commits into
mimblewimble:stagingfrom
syntaxjak:fix-stratum-leaks

Conversation

@syntaxjak

@syntaxjak syntaxjak commented Jun 19, 2026

Copy link
Copy Markdown

Addressing issue: #3867

  • Reworked the Stratum connection handling so reads and writes can run independently
  • Added bounded response queues, connection limits, and idle timeouts
  • Added an RAII cleanup guard so workers are removed correctly on disconnects and errors
  • Stratum connections and listener tasks now stop cleanly when the node shuts down
  • Added tests for connection cleanup, limits, backpressure, idle handling, and shutdown
  • Removed the unused async-stream dependency

@wiesche89
wiesche89 changed the base branch from master to staging June 20, 2026 07:35
@ardocrat ardocrat self-assigned this Jun 20, 2026
@iho

iho commented Jul 9, 2026

Copy link
Copy Markdown

Heads-up: #3889 also targets #3867 with the same structural approach (handle_connection + Drop guard + simpler accept loop).

That PR additionally adds idle timeout, max workers, and bounded write queues for the half-open / reconnect-storm failure mode. Worth coordinating so the two don’t land overlapping refactors without combining the resource bounds.

@wiesche89 wiesche89 assigned wiesche89 and unassigned wiesche89 Jul 22, 2026
@wiesche89
wiesche89 self-requested a review July 22, 2026 17:16

@wiesche89 wiesche89 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with a miner and additional connection tests. The cleanup works for normal disconnects, but it does not fully solve the reported connection leak yet. I’ve left a few comments on the remaining cases.

Image https://github.com/GetGrin/grim/issues/19

Comment thread .gitignore Outdated
Comment thread servers/src/mining/stratumserver.rs Outdated
Comment thread servers/src/mining/stratumserver.rs Outdated
Comment thread servers/src/mining/stratumserver.rs Outdated
Comment thread servers/src/mining/stratumserver.rs
Comment thread servers/src/mining/stratumserver.rs Outdated
Comment thread servers/src/mining/stratumserver.rs Outdated
Comment thread servers/src/mining/stratumserver.rs Outdated
@wiesche89
wiesche89 force-pushed the fix-stratum-leaks branch from ded14f2 to b7f96c5 Compare July 26, 2026 18:52
@wiesche89
wiesche89 requested a review from ardocrat July 26, 2026 21:27
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.

4 participants