Skip to content
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

pool: Correct account races. #402

Merged
merged 1 commit into from
Oct 9, 2023

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Oct 4, 2023

The account and name fields of a client are not set until they are received via a mining.authorize message and the account field is accessed from separate goroutines which is a race.

This corrects that issue by introducing a separate mutex to protect both the account and the name field and updating all references to by protected by the mutex accordingly.

The name field doesn't appear to be used anywhere currently, however, it would also be a race to access it without the mutex for the same reason, so this takes the opportunity to ensure it is protected in case it is used in the future.

Fixes #374.

The account and name fields of a client are not set until they are
received via a mining.authorize message and the account field is
accessed from separate goroutines which is a race.

This corrects that issue by introducing a separate mutex to protect both
the account and the name field and updating all references to by
protected by the mutex accordingly.

The name field doesn't appear to be used anywhere currently, however, it
would also be a race to access it without the mutex for the same reason,
so this takes the opportunity to ensure it is protected in case it is
used in the future.
@jholdstock jholdstock merged commit 3a35654 into decred:master Oct 9, 2023
2 checks passed
@davecgh davecgh deleted the pool_fix_account_and_name_race branch October 9, 2023 13:15
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.

Race between GUI and hub in generateHashIDs.
2 participants