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

account manager: avoid taking locks for long period of time #3717

Conversation

tsachiherman
Copy link
Contributor

@tsachiherman tsachiherman commented Mar 4, 2022

Summary

The DeleteOldKeys method was taking the lock for the duration of the keys deletion. This is not required, as the mutex really just need to be held to synchronize the list of participation keys. The underlying OneTimeSignatureSecrets already have a synchronization lock, which is taken as need.

Test Plan

Unit test added.

The output of the test help to detect the timing issues addressed in this PR. Before this PR, calling Key() 10 times took 4.1 seconds. With this PR, it takes 255us.

@cce cce requested a review from winder March 4, 2022 18:48
@tsachiherman tsachiherman merged commit d3dc437 into algorand:master Mar 7, 2022
@tsachiherman tsachiherman deleted the tsachi/avoidAccountManagerKeysDelays branch March 7, 2022 16:15
jannotti pushed a commit to jannotti/go-algorand that referenced this pull request Mar 13, 2022
…#3717)

## Summary

The `DeleteOldKeys` method was taking the lock for the duration of the keys deletion. This is not required, as the mutex really just need to be held to synchronize the list of participation keys. The underlying `OneTimeSignatureSecrets` already have a synchronization lock, which is taken as need.

## Test Plan

Unit test added.

The output of the test help to detect the timing issues addressed in this PR. Before this PR, calling Key() 10 times took 4.1 seconds. With this PR, it takes 255us.
@algojack algojack mentioned this pull request Mar 15, 2022
PhearZero pushed a commit to PhearNet/crypto that referenced this pull request Jan 17, 2025
…#3717)

## Summary

The `DeleteOldKeys` method was taking the lock for the duration of the keys deletion. This is not required, as the mutex really just need to be held to synchronize the list of participation keys. The underlying `OneTimeSignatureSecrets` already have a synchronization lock, which is taken as need.

## Test Plan

Unit test added.

The output of the test help to detect the timing issues addressed in this PR. Before this PR, calling Key() 10 times took 4.1 seconds. With this PR, it takes 255us.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants