While working with ExecutorEventHandler, I noticed that cancel functions for in-flight evaluations are tracked in a slice and cleaned up during normal execution.
However, in the case of a panic during execution, it’s not entirely clear that this cleanup is always guaranteed to run. If cleanup is skipped, it could leave stale cancel functions in the slice and lead to inconsistent internal state over time.
This isn’t causing any immediate issues in normal flows, but it could become problematic in edge cases or long-running processes.
It might be worth ensuring that cleanup logic (especially removal of cancel functions) always executes, even in panic scenarios, so that the lifecycle of these functions is fully reliable and predictable.
Happy to take this up if it makes sense.
While working with
ExecutorEventHandler, I noticed that cancel functions for in-flight evaluations are tracked in a slice and cleaned up during normal execution.However, in the case of a panic during execution, it’s not entirely clear that this cleanup is always guaranteed to run. If cleanup is skipped, it could leave stale cancel functions in the slice and lead to inconsistent internal state over time.
This isn’t causing any immediate issues in normal flows, but it could become problematic in edge cases or long-running processes.
It might be worth ensuring that cleanup logic (especially removal of cancel functions) always executes, even in panic scenarios, so that the lifecycle of these functions is fully reliable and predictable.
Happy to take this up if it makes sense.