Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.0] Check if parent is still running #881

Merged
merged 2 commits into from
Sep 3, 2020

Conversation

halaei
Copy link
Contributor

@halaei halaei commented Sep 3, 2020

Currently if horizon process gets terminated by SIGKILL, supervisor processes must be killed by kill command, or they will be provisioning workers for ever. There is no artisan command to terminate orphan supervisors, so it is a little bit of trouble.

If you want to see if you have orphan supervisors in your production, you can use the following command:

ps  xao pid,ppid,etime,time,comm,args|grep -P "^\\s+(PID|\\d+\\s+[01]\s.*horizon:)"

This PR lets the orphan supervisors check for their parent process id at the beginning of their loop, so they can terminate in case their parent, php artisan horizon, is no longer running.

@taylorotwell taylorotwell merged commit a3b39ac into laravel:master Sep 3, 2020
@@ -176,7 +184,8 @@ public function __construct($name,
$force = false,
$nice = 0,
$balanceCooldown = 3,
$balanceMaxShift = 1)
$balanceMaxShift = 1,
$parentId = 0)
Copy link
Member

@driesvints driesvints Mar 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@halaei why didn't you implement this argument? Atm it'll always be zero.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @driesvints It seems I made a mistake. Setting parentId in constructor also doesn't work because it is still zero in ensureParentIsRunning.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@halaei what do you mean? If we fix this by passing the $parentId from the constructor to the property it should work, no? Why do you think it would still be zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@driesvints I just dump() the value! It was 0 for sure. I sent a draft PR

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.

3 participants