0

Before this gets flagged as a duplicate, I read this question; however adding logfile2 did not change anything.


I'm currently creating a docker container that runs a Python stack with UWSGI, for this I used the default Debian installation of uwsgi for the init.d scripts, and installed the latest version on top of it using pip.

Whenever I start the service however, it outputs an error stating that the script failed to start, but when I try to make a request to the server (localhost:5000) or try to see if the processes are running using ps aux | grep -i uwsgi, the server runs just fine.

Example of what I mean:

root@f16b3268a956:~# /etc/init.d/uwsgi start
[FAIL] Starting app server(s): uwsgi -> ! failed!

However if I look at the running processes

root@f16b3268a956:~# ps aux | grep -i uwsgi
user       984  0.1  2.8 235284 57876 ?        S    14:15   0:00 /usr/local/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/portal.ini --daemonize /var/log/uwsgi/app/portal.log
user      1009  0.0  2.7 253204 57040 ?        S    14:15   0:00 /usr/local/bin/uwsgi --ini /usr/share/uwsgi/conf/default.ini --ini /etc/uwsgi/apps-enabled/portal.ini --daemonize /var/log/uwsgi/app/portal.log
root      1146  0.0  0.0  12860   976 pts/0    S+   14:24   0:00 grep -i uwsgi

Contents of my uwsgi configuration:

[uwsgi]
http-socket = localhost:5000
http-websockets = true
chmod-socket=775
chdir = /home/user/
master = true
binary-path = /usr/local/bin/uwsgi
virtualenv = /home/user/portal
module = portal.server:app
uid = user
gid = user
processes = 1
gevent = 1000
logfile2 = /tmp/test.pid
logto = /var/log/uwsgi/app/portal.log

Looking at the log file doesn't show anything strange either:

root@f16b3268a956:~# cat /var/log/uwsgi/app/portal.log
Thu Oct 25 14:29:48 2018 - *** Starting uWSGI 2.0.17.1 (64bit) on [Thu Oct 25 14:29:48 2018] ***
Thu Oct 25 14:29:48 2018 - compiled with version: 6.3.0 20170516 on 25 October 2018 13:26:09
Thu Oct 25 14:29:48 2018 - os: Linux-4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018
Thu Oct 25 14:29:48 2018 - nodename: f16b3268a956
Thu Oct 25 14:29:48 2018 - machine: x86_64
Thu Oct 25 14:29:48 2018 - clock source: unix
Thu Oct 25 14:29:48 2018 - pcre jit disabled
Thu Oct 25 14:29:48 2018 - detected number of CPU cores: 4
Thu Oct 25 14:29:48 2018 - current working directory: /
Thu Oct 25 14:29:48 2018 - writing pidfile to /run/uwsgi/app/portal/pid
Thu Oct 25 14:29:48 2018 - detected binary path: /usr/local/bin/uwsgi
Thu Oct 25 14:29:48 2018 - setgid() to 1000
Thu Oct 25 14:29:48 2018 - setuid() to 1000
Thu Oct 25 14:29:48 2018 - chdir() to /home/user/
Thu Oct 25 14:29:48 2018 - writing pidfile to /tmp/test.pid
Thu Oct 25 14:29:48 2018 - your memory page size is 4096 bytes
Thu Oct 25 14:29:48 2018 - detected max file descriptor number: 1048576
Thu Oct 25 14:29:48 2018 - - async cores set to 1000 - fd table size: 1048576
Thu Oct 25 14:29:48 2018 - lock engine: pthread robust mutexes
Thu Oct 25 14:29:48 2018 - thunder lock: disabled (you can enable it with --thunder-lock)
Thu Oct 25 14:29:48 2018 - uwsgi socket 0 bound to UNIX address /run/uwsgi/app/portal/socket fd 3
Thu Oct 25 14:29:48 2018 - uwsgi socket 1 bound to TCP address localhost:5000 fd 5
Thu Oct 25 14:29:48 2018 - Python version: 3.6.6 (default, Sep  5 2018, 03:40:52)  [GCC 6.3.0 20170516]
Thu Oct 25 14:29:48 2018 - Set PythonHome to /home/user/portal
Thu Oct 25 14:29:48 2018 - Python main interpreter initialized at 0x563332cd13a0
Thu Oct 25 14:29:48 2018 - python threads support enabled
Thu Oct 25 14:29:48 2018 - your server socket listen backlog is limited to 100 connections
Thu Oct 25 14:29:48 2018 - your mercy for graceful operations on workers is 60 seconds
Thu Oct 25 14:29:48 2018 - mapped 21036928 bytes (20543 KB) for 1000 cores
Thu Oct 25 14:29:48 2018 - *** Operational MODE: async ***
Thu Oct 25 14:29:49 2018 - WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x563332cd13a0 pid: 1814 (default app)
Thu Oct 25 14:29:49 2018 - *** uWSGI is running in multiple interpreter mode ***
Thu Oct 25 14:29:49 2018 - spawned uWSGI master process (pid: 1814)
Thu Oct 25 14:29:49 2018 - spawned uWSGI worker 1 (pid: 1839, cores: 1000)
Thu Oct 25 14:29:49 2018 - *** running gevent loop engine [addr:0x5633314d0fd0] ***

Does anyone know how to get around this?

0

I ended up solving the issue by basing my image off of the following docker image which uses supervisord rather than an init.d process (without systemctl).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.