uwsgi inside a (thin) jail problems with service uwsgi reload / status / stop

Hello!

I have created a thin jail following the structure described here https://docs.freebsd.org/en/books/handbook/jails/#creating-thin-jail-nullfs (with UFS).
When I run service uwsgi reload, it works the first time but after this first reload, then either service uwsgi status, service uwsgi reload or service uwsgi stop work anymore, they say:

sh:
uwsgi not running? (check /var/run/uwsgi.pid).

So I have checked this pid file, it's here and contains the correct pid (same as the master uwsgi process given by ps aux | grep uwsgi).

But I have noticed something special, the process "name" (or identifier) changes after a reload, probably triggering the problem:
sh:
root@web0:/ # service uwsgi start
Starting uwsgi.
[uWSGI] getting INI configuration from /usr/local/www/uwsgi.ini
root@web0:/ # ps aux | grep uwsgi
uwsgi  4440 26,1  1,2 73552 50244  -  SJ   07:38    0:00,20 /usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.pid -d /v
uwsgi  4441 26,1  1,2 73552 50244  -  SJ   07:38    0:00,20 /usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.pid -d /v
uwsgi  4443 26,1  1,2 73552 50244  -  SJ   07:38    0:00,17 /usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.pid -d /v
uwsgi  4442 25,8  1,2 73552 50240  -  SJ   07:38    0:00,17 /usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.pid -d /v
uwsgi  4439  9,4  1,2 64876 49740  -  SJ   07:38    0:01,87 /usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.pid -d /v
root   4445  0,0  0,0  3596  1800  0  R+J  07:38    0:00,00 grep uwsgi
root@web0:/ # service uwsgi reload
Gracefully reloading uwsgi without closing the main sockets.
root@web0:/ # ps aux | grep uwsgi
uwsgi  4458 33,0  1,2 73552 50260  -  SJ   07:39    0:00,20 /skeleton/usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.
uwsgi  4457 32,9  1,2 73552 50256  -  SJ   07:39    0:00,21 /skeleton/usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.
uwsgi  4455 32,7  1,2 73552 50256  -  SJ   07:39    0:00,21 /skeleton/usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.
uwsgi  4456 32,7  1,2 73552 50256  -  SJ   07:39    0:00,20 /skeleton/usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.
uwsgi  4439 12,9  1,2 64876 49756  -  SJ   07:38    0:04,57 /skeleton/usr/local/bin/uwsgi-3.11 --ini /usr/local/www/uwsgi.ini --master --uid uwsgi --gid uwsgi --pidfile /var/run/uwsgi.
root   4460  0,0  0,1 13916  2120  0  S+J  07:39    0:00,00 grep uwsgi
root@web0:/ # cat /var/run/uwsgi.pid
4439
root@web0:/ # service uwsgi status
uwsgi is not running.
root@web0:/ # service uwsgi stop
uwsgi not running? (check /var/run/uwsgi.pid).
root@web0:/ #

The only way I have found to fix this is to change the command= line in /usr/local/etc/rc.d/uwsgi to /skeleton/usr/local/bin/uwsgi-3.11 (so, I add the /skeleton prefix).
Problem is, this file is provided by the pkg install command, and further updates may remove my change.
I have tried to add this to /etc/rc.conf:
Code:
uwsgi_command="/skeleton/usr/local/bin/uwsgi-3.11"
uwsgi_command_interpreter="/skeleton/usr/local/bin/uwsgi-3.11"
But this is completely ignored.

I have also tried to add it to /etc/rc.d/uwsgi:
Code:
root@web0:/ # cat /etc/rc.d/uwsgi
#!/bin/sh
. /usr/local/etc/rc.d/uwsgi
command="/skeleton/usr/local/bin/uwsgi-3.11"

But this is ignored too. Is there any way to fix the problem without touching /usr/local/etc/rc.d/uwsgi?
(Or maybe to change a setup in the jail, so this /skeleton prefix does not show up later?)
 
Well, I forgot to mention that I already tried this one too, without any effect.
So I checked it again and indeed, only adding a procname in /etc/rc.conf doesn't change anything, it seems ignored.
But if I add:
Code:
auto-procname = true
procname-master = uWSGI  # same as in /etc/rc.conf
in uwsgi.ini, then this time it seems to work. (I am a bit cautious, because last time it failed randomly, very strange behavior, but maybe I had other variables set to incorrect values?).
 
Back
Top