nickstenning / honcho

Honcho: a python clone of Foreman. For managing Procfile-based applications.
http://pypi.python.org/pypi/honcho
MIT License
1.6k stars 146 forks source link

Commands are terminated with rc=-15 after first exits with 0; foreman works #155

Closed seeholza closed 9 years ago

seeholza commented 9 years ago

I am trying to start this procfile:

nginx: nginx -c `pwd`/conf/nginx/nginx.conf
uwsgi: uwsgi --ini conf/uwsgi/uwsgi.ini

and get the following behavior, where uwsgi exits with 0, then nginx is terminated by honcho.

16:37:49 system  | nginx.1 started (pid=16245)
16:37:49 system  | uwsgi.1 started (pid=16246)
16:37:49 uwsgi.1 | [uWSGI] getting INI configuration from conf/uwsgi/uwsgi.ini
16:37:49 system  | uwsgi.1 stopped (rc=0)
16:37:49 system  | sending SIGTERM to nginx.1 (pid 16245)
16:37:49 system  | nginx.1 stopped (rc=-15)

If I comment out one of the two lines, each works fine. Also, foreman runs this without problems:

16:38:38 nginx.1 | started with pid 16259
16:38:38 uwsgi.1 | started with pid 16260
16:38:38 uwsgi.1 | [uWSGI] getting INI configuration from conf/uwsgi/uwsgi.ini
16:38:38 uwsgi.1 | exited with code 0
16:38:38 system  | sending SIGTERM to all processes
16:38:38 nginx.1 | exited with code 0

Both lines just start nginx and uwsgi daemons, which continue running for foreman, but not for honcho. Could this be due to the fact that both processes after starting daemons exit as soon as they are done?

nickstenning commented 9 years ago

That looks like a straightforward matter of timing. Your foreman log clearly says:

16:38:38 system  | sending SIGTERM to all processes

but it apparently doesn't get there before nginx daemonises.

Honcho isn't designed for running processes that fork. If you want to do that, then you can just write a two line shell script:

nginx -c `pwd`/conf/nginx/nginx.conf
uwsgi --ini conf/uwsgi/uwsgi.ini