vanadium / core

Slimmed down version of Vanadium that is focused on its RPC and security system.
BSD 3-Clause "New" or "Revised" License
89 stars 28 forks source link

Goroutines leak in WithRootCancel #288

Closed richhx closed 2 years ago

richhx commented 3 years ago

Whenever a child context is created via WithRootCancel, a goroutine spawns to gracefully handle closing the child context whenever the root context gets canceled.

However, the current implementation leaks goroutines whenever the child context exits before the root context exits.

richhx commented 3 years ago

See https://github.com/vanadium/core/pull/214 for the test reproduction. Happy to provide pprof metrics as needed too.