We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When restarting Sanic, some (forked) process might not be killed properly, causing them to stay alive and increasing the resouce usage (memory, cpu).
In the long run, after multiple restarts, this leads to a system becoming instable.
Here's a copy of the ps aux | grep [m]ultiproc command:
ps aux | grep [m]ultiproc
user 3317222 0.0 0.7 1397988 513156 ? Sl Aug21 4:33 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=18) --multiprocessing-fork user 3317224 0.0 0.6 1227500 436072 ? Sl Aug21 3:22 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=20) --multiprocessing-fork user 3317226 0.0 0.4 1257428 325252 ? Sl Aug21 2:18 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=22) --multiprocessing-fork user 3317228 0.0 1.3 1496080 902568 ? Sl Aug21 12:32 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=24) --multiprocessing-fork user 3317230 0.0 0.9 1256720 609312 ? Sl Aug21 7:53 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=26) --multiprocessing-fork user 3317232 0.0 1.1 1390208 732892 ? Sl Aug21 8:20 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=28) --multiprocessing-fork user 3317233 0.0 1.0 1441388 686740 ? Sl Aug21 6:40 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=30) --multiprocessing-fork user 3317235 92.8 1.6 1480008 1053132 ? Rl Aug21 29348:51 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=32) --multiprocessing-fork user 3317238 0.0 1.3 1433156 904704 ? Sl Aug21 11:20 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=34) --multiprocessing-fork user 3317239 0.0 1.0 1273864 675260 ? Sl Aug21 9:42 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=36) --multiprocessing-fork user 3317241 0.0 0.8 1338840 548328 ? Sl Aug21 5:52 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=39) --multiprocessing-fork user 3317242 0.0 1.3 1368812 880972 ? Sl Aug21 14:40 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=64) --multiprocessing-fork user 3868075 0.0 0.0 15044 11120 ? S Mar19 0:00 /var/www/project/env/bin/python -c from multiprocessing.resource_tracker import main;main(5) user 3868076 2.4 0.0 1093636 41204 ? Sl Mar19 6260:56 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=8) --multiprocessing-fork user 3868085 0.0 0.0 15044 10980 ? S Mar19 0:00 /var/www/project/env/bin/python -c from multiprocessing.resource_tracker import main;main(5) user 3868086 2.5 0.0 1250296 61720 ? Sl Mar19 6382:19 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=8) --multiprocessing-fork user 3868094 0.0 0.0 62500 37468 ? S Mar19 0:02 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=18) --multiprocessing-fork user 3868095 0.0 0.0 62496 37180 ? S Mar19 0:28 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=20) --multiprocessing-fork user 3868096 0.0 0.0 62496 37304 ? S Mar19 0:04 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=22) --multiprocessing-fork user 3868097 0.0 0.0 62500 37212 ? S Mar19 0:01 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=24) --multiprocessing-fork user 3868098 0.0 0.0 62496 37468 ? S Mar19 0:08 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=26) --multiprocessing-fork user 3868099 0.0 0.0 62496 37520 ? S Mar19 0:06 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=28) --multiprocessing-fork user 3868100 0.0 0.0 62504 37476 ? S Mar19 0:13 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=30) --multiprocessing-fork user 3868101 0.0 0.0 62504 37468 ? S Mar19 0:18 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=32) --multiprocessing-fork user 3868102 0.0 0.0 62492 37188 ? S Mar19 0:48 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=34) --multiprocessing-fork user 3868103 0.0 0.0 62500 37456 ? S Mar19 1:05 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=36) --multiprocessing-fork user 3868104 0.0 0.0 62496 37268 ? S Mar19 0:36 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=38) --multiprocessing-fork user 3868105 0.0 0.0 62496 37228 ? S Mar19 1:29 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=40) --multiprocessing-fork user 3868106 0.6 0.0 61112 34804 ? S Mar19 1555:37 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=42) --multiprocessing-fork user 3868152 1.1 0.0 86668 56932 ? S Mar19 2815:44 /var/www/project/env/bin/python -c from multiprocessing.spawn import spawn_main; spawn_main(tracker_fd=6, pipe_handle=42) --multiprocessing-fork
Sanic is started using Supervisor with the following script:
[program:myapp] user = user command=/var/www/myapp/env/bin/python /var/www/myapp/www/server.py --prod autostart=true autorestart=true stopsignal=INT startsecs=2 stopwaitsecs=5
And here's the content of server.py used by Supervisor (nothing fancy):
server.py
#!./env/bin/python # -*- coding:utf-8 -*- from app import App import sys, os, argparse sys.path.append(os.path.dirname(os.path.realpath(__file__))) app = App().app if __name__ == '__main__': parser = argparse.ArgumentParser(description='Start the Sanic[Fernand] server') args = parser.parse_args() autoreload = None app.run(**{ 'host': '127.0.0.1', 'port': 5000, 'dev': False, 'access_log': False, 'fast': True })
When stopping Sanic, all processes should be stopped, including the forked one.
Sanic CLI
Linux
23.12
I'm not sure about the Sanic version because process were as old as March and at the time, we were using Sanic==23.12
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Is there an existing issue for this?
Describe the bug
When restarting Sanic, some (forked) process might not be killed properly, causing them to stay alive and increasing the resouce usage (memory, cpu).
In the long run, after multiple restarts, this leads to a system becoming instable.
Here's a copy of the
ps aux | grep [m]ultiproc
command:Code snippet
Sanic is started using Supervisor with the following script:
And here's the content of
server.py
used by Supervisor (nothing fancy):Expected Behavior
When stopping Sanic, all processes should be stopped, including the forked one.
How do you run Sanic?
Sanic CLI
Operating System
Linux
Sanic Version
23.12
Additional context
I'm not sure about the Sanic version because process were as old as March and at the time, we were using Sanic==23.12
The text was updated successfully, but these errors were encountered: