[5.7] Fix an issue where the worker process would not be killed by the listener when the timeout is exceeded #25981
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.
Refer to #25980 for the issue.
This PR fixes the issue by passing an array into the Process constructor rather than the formatted stripe. Refer to symfony/symfony#21474 for the reason for passing an array in.
Here are some test cases that I've tried to show how they differ. I ran
php artisan queue:listen database --timeout 10
on the 5.7 branch and on my branch. Then I ranps -ef | grep "[q]ueue"
. The results from that second command are as follows:On the 5.7 branch, on Mac:
On the 5.7 branch, on Linux:
On the my branch, on Mac:
On the my branch, on Linux:
As you can see, on my branch the listener correctly forks the worker command, which will allow the SIGTERM signal to terminate the correct process.
Let me know what you think about this approach, and if you know any issues with this.