0

I am troubleshooting the stack of sysvinit scripts shipped with Debian (Buster) for UWSGI /etc/init.d/uwsgi.

From debugging my Docker instance, I can see that the UWSGI master and workers are running after executing service uwsgi start. However, I get this output:

root@fab01640bf85:/# service uwsgi start
Starting app server(s): uwsgi -> ! failed!

This is very similar to "sudo service uwsgi restart" returns [fail] however uwsgi logs show processes have been created and python app is running but the solution doesn't work.

By debugging, I found a test in /usr/share/uwsgi/init/specific_daemon will fail if UWSGI can still be started. This is indeed also the false positive that makes service uwsgi start fail. The logic is this: 1) Start UWSGI daemon 2) Call start-stop-daemon --test and fail if UWSGI would be started again (because it should already be running).

I condensed and reproduced the behavior here:

# Intended action: To start UWSGI
root@fab01640bf85:/# start-stop-daemon --test --start --pidfile "/run/uwsgi/app/rtd/pid" --exec "/usr/bin/uwsgi" --  --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/rtd.ini --daemonize /var/log/uwsgi/app/rtd.log
Would start /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/rtd.ini --daemonize /var/log/uwsgi/app/rtd.log .

# Check that PID file is readable
root@fab01640bf85:/# ls -l /run/uwsgi/app/rtd/pid 
-rw-r--r--. 1 root root 5 Jul 20 09:36 /run/uwsgi/app/rtd/pid

# Here's the PID file's contents
root@fab01640bf85:/# cat /run/uwsgi/app/rtd/pid
7908

# ..and the PID exists!
root@fab01640bf85:/# ps ax| grep 7908
   7908 ?        S      0:01 /usr/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/rtd.ini --daemonize /var/log/uwsgi/app/rtd.log

What could reasons that start-stop-daemon --test gives this false positive? Why is it not seeing the already running instance through the PID?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.