Skip to content

Conversation

@positiveblue
Copy link
Contributor

The rpcserver cannot have more than one account recovery process running
at once. The server uses a internal attribute (recoveryPending) that
is set to true when a new recovery process starts. However, that
attribute was only set to false if the process ended successfully,
leaving the server unable to try more recoveries after a failure.

@positiveblue positiveblue changed the title rpcserver: fix recoveryPending atrib. rpcserver: fix recoveryPending attribute Apr 11, 2022
Copy link
Contributor

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice fix, thank you!

}

s.recoveryPending = true
// Mark the recovery process as done whenever we finish.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we move this whole block just one line down, so it's after the Unlock()? That way it's a bit easier to reason about whether this could lead to a deadlock or not (in case you miss the defer when scanning the code linearly).

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, my comment was a bit inaccurate. But the s.recoveryPending = true should still be within the lock.

Copy link
Member

@bhandras bhandras left a comment

Choose a reason for hiding this comment

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

LGTM 👍

s.recoveryMutex.Lock()
if s.recoveryPending {
defer s.recoveryMutex.Unlock()
s.recoveryMutex.Unlock()
Copy link
Member

Choose a reason for hiding this comment

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

nit: alternatively we could just use an atomic int to avoid the (slightly complex) locking logic.

The rpcserver cannot have more than one account recovery process running
at once. The server uses a internal attribute (`recoveryPending`) that
is set to true when a new recovery process starts. However, that
attribute was only set to false if the process ended successfully,
leaving the server unable to try more recoveries after a failure.
@positiveblue positiveblue merged commit 6d93ea0 into master Apr 12, 2022
@guggero guggero deleted the account-recover-fix branch May 5, 2022 15:25
positiveblue pushed a commit to positiveblue/pool that referenced this pull request Oct 11, 2022
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