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

Add the killing of children #668

Merged
merged 1 commit into from
Apr 28, 2017

Conversation

seemethere
Copy link
Member

Kills children processes when parent process receives a signal to
shutdown.

Solves for #594

Kills children processes when parent process receives a signal to
shutdown.

Solves for sanic-org#594
@seemethere seemethere requested a review from r0fls April 28, 2017 00:48
@seemethere seemethere added this to the 0.5.3 milestone Apr 28, 2017
Copy link
Contributor

@r0fls r0fls left a comment

Choose a reason for hiding this comment

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

Unfortunately this doesn't work. To illustrate, the below can be app.py:

from sanic import Sanic
from sanic.response import json

app = Sanic(__name__)


@app.route("/")
async def test(request):
    return json({"test": True})

app.static('/', './')

if __name__ == '__main__':
    app.run(host="0.0.0.0", port=8000, workers=3)

then kill the lowest number process (find it with ps aux | grep app.py). You can see the others are still running (again with ps aux | grep app.py.

@seemethere
Copy link
Member Author

seemethere commented Apr 28, 2017 via email

@r0fls
Copy link
Contributor

r0fls commented Apr 28, 2017

the parent process

This is what I meant by the lowest number process listed in ps aux | grep app.py, as the parent process number is not displayed for me during sanic startup.

@r0fls
Copy link
Contributor

r0fls commented Apr 28, 2017

I thought this was working a long time ago 👿

@seemethere
Copy link
Member Author

Are you sure you're killing the parent process? When I did it with an os.getpid() it seemed to work fine.

@r0fls
Copy link
Contributor

r0fls commented Apr 28, 2017

derp, i was sending a kill signal not int. kill -2 parent_pid works

@r0fls r0fls merged commit 656f5b9 into sanic-org:master Apr 28, 2017
@r0fls
Copy link
Contributor

r0fls commented Apr 28, 2017

nice title btw, much like the god cronos

@seemethere
Copy link
Member Author

You know how I do :D

@seemethere seemethere deleted the stop_workers_on_sigint branch April 28, 2017 06:53
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.

None yet

3 participants