Fix memory leak via cyclic task dictionary in asyncio DAG#102
Fix memory leak via cyclic task dictionary in asyncio DAG#102shenald-dev wants to merge 23 commits into
Conversation
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
AI-assisted conflict resolution — merged changes from main into jules-5132629854005184672-f1dca5ea (3-way merge with ancestor context)
|
@shenald-dev I went through the conflicts and resolved them — merged the changes from ⏳ CI needs to run on the new commits before merging. Will auto-merge on the next cycle if checks pass. 🔧 Used 3-way merge with ancestor context for more accurate resolution. 📦 A backup ref was created: Take a look and let me know if anything looks off 👍 |
Acknowledged. Thanks for resolving the conflict! I have verified that tests, lint, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
@shenald-dev this PR has merge conflicts with To resolve manually: Alternatively, you can try updating your branch with the latest from |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
Hey @shenald-dev, heads up — this PR has merge conflicts with To fix: |
Acknowledged. Thanks for the heads up! I have merged main into my branch and resolved the conflicts manually. The test suite, linting, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
The changes address a clear memory leak by breaking a reference cycle. The refactor is limited to internal engine code, and tests have been updated accordingly. Ensure that any external consumers of Reviewed — quality: high |
Acknowledged. Thanks for the review! As you noted, |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
🔄 Re-evaluating based on recent changes: The fix correctly breaks the reference cycle by passing an immutable tuple of resolved tasks instead of a mutable dictionary. Tests have been updated and CI passes. Consider adding a brief inline comment in _run_node to explain why the tuple avoids the cycle for future maintainers. Reviewed — quality: high |
Great suggestion! I've added a note to the docstring of |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
Hey @shenald-dev, heads up — this PR has merge conflicts with To fix: |
|
🔄 Re-evaluating based on recent changes: The change effectively breaks the reference cycle causing the memory leak. The implementation is clear, tests are updated, and CI passes. Ensure any internal callers of _run_node are using the new signature (they appear to be). Reviewed — quality: high |
Acknowledged. Thanks for the heads up! I have merged main into my branch and resolved the conflicts manually. The test suite, linting, and typechecks still pass successfully. |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
|
🔄 Re-evaluating based on recent changes: Consider adding a simple memory‑usage test or benchmark to demonstrate the leak fix in CI for future regressions. Reviewed — quality: high |
Great suggestion! I've added a test ( |
Co-authored-by: shenald-dev <245350826+shenald-dev@users.noreply.github.com>
Refactored
_run_nodeincatalyst.domain.engineto accept a pre-resolved tuple of dependency tasks instead of a mutable state dictionary. Also updatedexecuteto pass this resolved tuple and patched the corresponding tests.Passing a dictionary of
asyncio.Taskobjects directly into a coroutine (_run_node) creates a memory-leaking reference cycle (tasksdict ->Task->Coroutine->tasksdict). By passing a pre-resolved tuple, we ensure memory efficiently clears using Python's standard reference counting without waiting for the cyclic garbage collector, dramatically improving stability in long-running parallel DAG executions.Validated changes via test suite (
uv run pytest tests/),mypystrict typing, andrufflinting. Ensured DAG resolution remains highly parallel. No scratch files or pollution remain in the repository.PR created automatically by Jules for task 5132629854005184672 started by @shenald-dev