Skip to content

[11.x] Fix Pipeline memory leak in long-lived workers#17

Open
JoshSalway wants to merge 1 commit into11.xfrom
fix/framework-56395
Open

[11.x] Fix Pipeline memory leak in long-lived workers#17
JoshSalway wants to merge 1 commit into11.xfrom
fix/framework-56395

Conversation

@JoshSalway
Copy link
Owner

Summary

  • After Pipeline::then() completes, $passable and $pipes properties retain references to objects passed through the pipeline
  • For queue workers (Octane, Horizon), this holds job objects in memory until the next job replaces them
  • Two-line fix: set $this->passable = null and $this->pipes = [] after execution

Related Issue

Fixes laravel#56395

Test plan

  • Verify Pipeline clears references after then() completes
  • Verify Pipeline still works correctly for subsequent send()/through()/then() calls
  • Monitor memory usage in long-lived queue workers

🤖 Generated with Claude Code

After Pipeline::then() completes, the $passable and $pipes properties
retain references to objects passed through the pipeline. For queue
workers, this means job objects are held in memory unnecessarily until
the next job replaces them, causing workers to hit memory limits sooner.

Fixes laravel#56395

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

A job does not release its memory after being ran

1 participant