onflow / atree

Atree provides scalable arrays and scalable ordered maps.
https://onflow.org
Apache License 2.0
39 stars 16 forks source link

Fix handling of edge case involving error that can cause a "send on closed channel" panic #240

Closed fxamacker closed 2 years ago

fxamacker commented 2 years ago

Problem

@turbolent reported a problem in CI.

FastCommit() will exit if a goroutine returns an error. This early exit triggers defer close(results) which closes the channel. The first of any remaining goroutine to send over the closed channel will cause a "send on closed channel" panic.