Skip to content

fix: resolve memory leaks, race conditions, and listener cleanup issues in parallel task execution#74

Open
nikomatt69 wants to merge 1 commit intoxmaxfrom
claude/fix-parallel-task-cleanup-Gbk7n
Open

fix: resolve memory leaks, race conditions, and listener cleanup issues in parallel task execution#74
nikomatt69 wants to merge 1 commit intoxmaxfrom
claude/fix-parallel-task-cleanup-Gbk7n

Conversation

@nikomatt69
Copy link
Owner

Memory Leak Fixes:

  • streaming-orchestrator: Remove absorbed messages beyond limit to prevent messageQueue growth
  • streaming-orchestrator: Add performPostTaskCleanup() to clean state after parallel task completion
  • agent-service: Add cleanupCompletedTasks() to remove old completed tasks from activeTasks map
  • plan-executor: Add cleanupExecutionHistory() and clearExecutionHistory() methods
  • parallel-task-context-manager: Add automatic cleanup of completed chains after 60 seconds
  • parallel-task-context-manager: Add dispose() method for full resource cleanup

Listener Cleanup Fixes:

  • plan-executor: Refactor executeAgentStep() to use proper listener tracking and guaranteed cleanup in finally block
  • plan-executor: Clear timeout handles and all registered listeners even on errors or timeouts

Race Condition Fixes:

  • plan-executor: Use local variable tracking for listeners to prevent race between timeout and completion
  • streaming-orchestrator: Ensure input queue bypass is disabled after task completion

Additional Improvements:

  • Add bounds on Map sizes to prevent unbounded growth
  • Clear panels content on task completion to free memory
  • Clean adaptive metrics entries to prevent accumulation

…es in parallel task execution

Memory Leak Fixes:
- streaming-orchestrator: Remove absorbed messages beyond limit to prevent messageQueue growth
- streaming-orchestrator: Add performPostTaskCleanup() to clean state after parallel task completion
- agent-service: Add cleanupCompletedTasks() to remove old completed tasks from activeTasks map
- plan-executor: Add cleanupExecutionHistory() and clearExecutionHistory() methods
- parallel-task-context-manager: Add automatic cleanup of completed chains after 60 seconds
- parallel-task-context-manager: Add dispose() method for full resource cleanup

Listener Cleanup Fixes:
- plan-executor: Refactor executeAgentStep() to use proper listener tracking and guaranteed cleanup in finally block
- plan-executor: Clear timeout handles and all registered listeners even on errors or timeouts

Race Condition Fixes:
- plan-executor: Use local variable tracking for listeners to prevent race between timeout and completion
- streaming-orchestrator: Ensure input queue bypass is disabled after task completion

Additional Improvements:
- Add bounds on Map sizes to prevent unbounded growth
- Clear panels content on task completion to free memory
- Clean adaptive metrics entries to prevent accumulation
@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
nikcli f664186 Jan 06 2026, 05:36 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants