Log client: WaitForRootUpdate "stuck" with concurrent calls to AddLeaf
- Dominant language
- Go
- Stars
- 3.7k
- Forks
- 465
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 5
Description
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: https://github.com/gpdionisio/trillian/commit/8acb0525a5a389e4818f470980a54e737456beee
This commit is a proposed fix: https://github.com/gpdionisio/trillian/commit/d0f7ad2d3ae7d8685332ae2cf9ae14de91e6060e
Contributor guide
Assessment
This issue has not been assessed yet.