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

Log client: WaitForRootUpdate "stuck" with concurrent calls to AddLeaf #3294

Open
gpdionisio opened this issue Jan 17, 2024 · 2 comments
Open

Comments

@gpdionisio
Copy link

gpdionisio commented Jan 17, 2024

If LogClient.AddLeaf is called concurrently (and thus multiple leaves are queued, and then processed together in a single pass of the operation manager), when the LogClient.root is updated, only one of the concurrent calls to WaitForRootUpdate successfully return.

When the other goroutines reach LogClient.UpdateRoot the new trusted root of the client is already updated, therefore they keep waiting in WaitForRootUpdate until either a new leaf is added, or the context expires/is canceled.

This commit reproduces the behavior in a unit test: gpdionisio@8acb052

This commit is a proposed fix: gpdionisio@d0f7ad2

@roger2hk
Copy link
Contributor

I haven't looked into details but this looks similar to #3236 at a glance.

@gpdionisio
Copy link
Author

I could be wrong, but I think this is a different issue. There is no deadlock here.

As shown in the test, the trusted root is updated by one goroutine while the others sleep in WaitForRootUpdate. When they wake up and call UpdateRoot, they compare the new root received from the server with the trusted one (which was updated while they were sleeping), and, since they are the same, they keep waiting for the next root update.

But callers of AddLeaf shouldn't wait for the next update, because their leaf has already been processed.

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

No branches or pull requests

2 participants