Fix race condition in SharesMonitor that drops shares during send#218
Open
rx18-eng wants to merge 1 commit into
Open
Fix race condition in SharesMonitor that drops shares during send#218rx18-eng wants to merge 1 commit into
rx18-eng wants to merge 1 commit into
Conversation
Contributor
Author
|
@jbesraa @Priceless-P does this seem valid to you ? |
jbesraa
requested changes
Apr 20, 2026
Contributor
jbesraa
left a comment
There was a problem hiding this comment.
I think we should add tests to this module before changing it
d9ec044 to
290eccb
Compare
jbesraa
requested changes
Apr 20, 2026
jbesraa
reviewed
Apr 20, 2026
Contributor
jbesraa
left a comment
There was a problem hiding this comment.
one small nit, looks good otherwise
Contributor
Author
|
@jbesraa plss let me know if anyother changes are needed ! |
Contributor
|
thanks @rx18-eng this looks good. can u please squash commits? |
Signed-off-by: rx18-eng <remopanda78@gmail.com>
14777ab to
c14a1e2
Compare
Contributor
Author
|
@jbesraa i have squahed the commits , let me knowif any other changes are needed before you merge ! |
Contributor
Author
|
@jbesraa shall i update anything else on this pr? |
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.
The share monitor had a race condition where shares could get silently dropped. get_next_shares() clones the vec, then after the HTTP send finishes, clear_next_shares() wipes everything including shares that miners pushed while the request was in flight. Replaced the clone+clear with std::mem::take so it atomically moves shares out in one lock, and new shares that come in during the send just go into the fresh empty vec. Also added a requeue on send failure so shares don't get lost if the monitoring server is down.