fix: clear execution references when engine run finishes#1443
fix: clear execution references when engine run finishes#1443saschabuehrle wants to merge 1 commit intoinngest:mainfrom
Conversation
|
There was a problem hiding this comment.
LGTM
The cleanup is safe: it runs in the finally block after the core loop has fully resolved or errored, no external caller holds a reference to the execution object after start() completes, and all middleware hooks fire before the finally block. No correctness, data-loss, or security issues found.
Tag @mendral-app with feedback or questions. View session
|
It hasn't fixed the leak in my test, feel free to run against https://github.com/fdarian/inngest-memory-leak-repro
|

Fixes #1440
The execution engine retained internal references after completion (steps map, metadata, step state, fnArg, and the execution promise). In long-running processes this can keep step closures and large payloads reachable longer than necessary.
This adds a cleanup pass in the _start finally block to release those references once a run is finished, and includes a regression test that asserts the state is cleared after completion.
Greetings, saschabuehrle
Note
Adds a
releaseExecutionReferences()cleanup method called in thefinallyblock of_start()to clear step maps, metadata, step state, fnArg, and the execution promise after a run finishes. Includes a regression test that casts to internal types to assert the cleared state.Written by Mendral for commit 17ecdc2.