Skip to content

Ensure proper cleanup of cancel functions on panic in ExecutorEventHandler #6319

@sachin9058

Description

@sachin9058

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions