Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
receive: ensure callback errors are propagated
Previously, it was possible for errors returned by an asyncronous callback function to not be propagated, and to instead return "context canceled" from `Receive`. This could happen based on this specific sequence of events: - An asyncronous callback is called from `HandleChange`, and returns an error, completing the async errorgroup context with an error state. - Another call to `HandleChange` completes, and uses the context syncronously, returning `context.Canceled`. - This in turn propagates to `doubleWalkDiff`, which returns the canceled error, instead of calling `Wait` which would contain the actual error group error. This behavior is racy, based on exactly how and when the asyncronous callback is called. The fix to this is relatively straightforward: we just need to make sure that syncronous and asyncronous function calls are kept separate, and don't reuse the same context. This means that a failure in an async callback, doesn't cause later sync ones to fail. Signed-off-by: Justin Chadwell <me@jedevc.com>
- Loading branch information