Repository navigation
Fix queue:listen timeout false positives after system sleep/wake - #58216
Merged
Merged
Conversation
Fixes laravel#58178 The queue:listen command was creating a single Process object outside the loop and reusing it for each iteration. When the system goes to sleep, wall-clock time continues to advance while the process is suspended. Upon wake, Symfony Process checks if too much wall-clock time has passed and throws a ProcessTimedOutException, even though the process was suspended. By moving Process creation inside the loop, each iteration now gets a fresh Process instance with a clean timeout state. This prevents false timeout errors after system sleep/wake cycles while maintaining proper timeout protection for actually stuck processes. Changes: - Move Process creation inside listen() method's while loop - Each queue:work --once invocation now gets a fresh Process object - Timeout counter starts fresh for each subprocess invocation
Member
|
This actually doesn't fix the issue for me locally. Reverting. |
Contributor
Author
|
Thanks for checking and confirming, Taylor — appreciate you taking the time to test and revert. I’ll pause on this for now and revisit if I’m able to reproduce the behavior more reliably across environments. Thanks again. |
akyrey
pushed a commit
to akyrey/framework
that referenced
this pull request
Dec 29, 2025
…avel#58216) * Fix queue:listen timeout false positives after system sleep/wake Fixes laravel#58178 The queue:listen command was creating a single Process object outside the loop and reusing it for each iteration. When the system goes to sleep, wall-clock time continues to advance while the process is suspended. Upon wake, Symfony Process checks if too much wall-clock time has passed and throws a ProcessTimedOutException, even though the process was suspended. By moving Process creation inside the loop, each iteration now gets a fresh Process instance with a clean timeout state. This prevents false timeout errors after system sleep/wake cycles while maintaining proper timeout protection for actually stuck processes. Changes: - Move Process creation inside listen() method's while loop - Each queue:work --once invocation now gets a fresh Process object - Timeout counter starts fresh for each subprocess invocation * Update Listener.php --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes issue where
queue:listencommand crashes with a timeout error after the system wakes from sleep, even when no jobs are running.Related Issue: #58178
Problem
The
queue:listencommand was creating a singleProcessobject outside the loop and reusing it for each iteration. When the system goes to sleep:microtime(true)) continues to advancemicrotime(true) - starttime > timeoutProcessTimedOutException, even though the process was suspendedThis caused false timeout errors after system sleep/wake cycles, crashing
composer run devafter a few hours.Solution
Moved the
Processobject creation inside thelisten()method's loop, ensuring each iteration creates a freshProcessinstance with a clean timeout state.Before:
After:
Impact
queue:work --onceinvocation gets a fresh Process with clean timeout stateTesting
makeProcess()creates new Process instances each callNotes
This fix ensures that the timeout counter starts fresh for each subprocess invocation, preventing accumulated wall-clock time during system sleep from causing false positives.