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.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Order mixclient and syncer shutdown #2463
base: master
Are you sure you want to change the base?
Order mixclient and syncer shutdown #2463
Changes from all commits
7f35fe1
e77e577
007d62a
9a6e6f8
27a89a9
498b9b3
1033335
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't look right to me yet.
In the case an error is returned from
Run
unrelated to the context being canceled, that error would be returned which would cause the group context to be canceled so everything would be fine.However, when
wallet.Run
returnsnil
,walletCtx
will never be canceled afaict. Thus, it would just hang here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be cancelled by the goroutine started above this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://go.dev/play/p/5VPuDP_Bbtw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is assuming there is an error in the goroutines in the group though. There won't necessarily be one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://go.dev/play/p/sYabLXOyzoN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but they all return errors....
have you ran this and seen it hang?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't seen any issues, but I'm just considering the edge cases. So long as there is a never a case where the grouped goroutines all exit without an error, then the code is fine.
My worry is just basically what I described. Namely,
wallet.Run
returnsnil
and then it just sits and waits, effectively until either there is an error in the group or the outer context is canceled. That part is correct.However, it implies all of the goroutines in the group will be sitting there doing nothing after
wallet.Run
returns until eventually the outer context is canceled even though they really should be exiting afterwallet.Run
returns unconditionally so thatsyncer.Run
returns without error versus sitting around in a defunct state (akawallet.Run
is no longer running, but all of the goroutines in the group are).EDIT: So long as you're fine with that outcome, I'll approve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, after looking through more of the surrounding code, I guess it's just the poor naming of things that misled me and those other goroutines are supposed to remain active until the outer context is canceled regardless of whether or not the "wallet" is running. It'll still be processing p2p messages, fetching filters, etc.
I was completely misled by the naming to believe it was running the entire wallet (as it's named) as opposed to some optional additional background tasks.