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

BUG: Doorman manager child processing fix. #305

Merged

Conversation

mfendeksilverstripe
Copy link
Contributor

@mfendeksilverstripe mfendeksilverstripe commented Jun 9, 2020

Doorman manager child processing fix

Problem

Using asynchronous queue runner has a flaw - when the manager process terminates, it also terminates all of its child processes. This is a mistake because there is a valid use case where manager process doesn't have any more work to do (no more jobs to start) but the child processes are still executing jobs.

Solution

Fix the shell command and prevent the manager process from killing of the child processes.

Notes

  • Requires 3.1.0 version or higher of asyncphp/doorman
  • split from Feature batch as Feature 9 - Job manager process

Related issues

#306

Copy link
Collaborator

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Code wise its fine, though a couple of questions

You'll need to rebase/retarget this to 4 since it has new API

Also, would it be worth simply making this PR straight to asyncphp/doorman instead?

src/Services/ProcessManager.php Show resolved Hide resolved

public function __destruct()
{
// Prevent background tasks from being killed when this script finishes
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a valid reason why the default behaviour may be good? Is it worth making this behaviour a configurable value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The default behaviour is generally considered a more safe option and I would still want to keep it as a default. The only reason why we can bypass this here is that this module has a very good system in place which keeps track of running jobs (job locking...).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, so you're saying that it's no worth making this configurable because the queued jobs module does such a good job?
Should we do either of the following?
a) make this configurable?
b) add your rationale for why it's ok to bypass into the inline comments?

Copy link
Contributor Author

@mfendeksilverstripe mfendeksilverstripe Sep 18, 2020

Choose a reason for hiding this comment

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

I had a look at it in detail and I think it's worth making it configurable. There might be some cases where you want this to be disabled.

@mfendeksilverstripe
Copy link
Contributor Author

mfendeksilverstripe commented Sep 9, 2020

Rebased to 4, pushed up new changes, please review.

@mfendeksilverstripe
Copy link
Contributor Author

mfendeksilverstripe commented Sep 9, 2020

@emteknetnz To answer your question:

Also, would it be worth simply making this PR straight to asyncphp/doorman instead?

I don't think this changeset belongs to the doorman module as the change by itself is probably a bit dangerous default. In the context of this module it's different as there are other mechanisms in place which makes this change reasonable (job locking, execution timeouts).

@emteknetnz
Copy link
Collaborator

Mojmir, looking good, just a couple of questions around the destruct function

@mfendeksilverstripe
Copy link
Contributor Author

@emteknetnz Pushed up new changes (configurable child process termination + docs), please review.

@emteknetnz emteknetnz merged commit b1ce613 into symbiote:4 Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants