Solved A process survives a restart of the jail in which the process reside. How so?

Frankly I am quite puzzled. I have synapse (matrix) server installed in a jail. When I restart the jail, the process not only survives the restart, but start itself once again as well.
Before
service jail restart matrix
Code:
18:34 /root # ps -ax | grep synapse
71422  -  SsJ     0:09.13 /usr/local/bin/python3.6 -m synapse.app.homeserver --daemonize -c /usr/local/etc/matrix-synapse/homeser
71603  -  IsJ     0:00.14 postgres: synapse_user synapse 10.1.1.8(17671)  (postgres)
72397  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(39734)  (postgres)
72575  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(48464)  (postgres)
72821  -  IsJ     0:00.18 postgres: synapse_user synapse 10.1.1.8(33224)  (postgres)
73216  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(13992)  (postgres)
74282  -  IsJ     0:00.16 postgres: synapse_user synapse 10.1.1.8(33434)  (postgres)
78655  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(43654)  (postgres)
79232  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(43655)  (postgres)
87376  -  IsJ     0:00.13 postgres: synapse_user synapse 10.1.1.8(43663)  (postgres)
88057  -  IsJ     0:00.14 postgres: synapse_user synapse 10.1.1.8(43664)  (postgres)
37713  1  R+      0:00.00 grep synapse
After service jail restart matrix
Code:
18:35 /root # service jail restart matrix
Stopping jails: matrix.
Starting jails: matrix.
18:35 /root # ps -ax | grep synapse
54382  -  SsJ     0:00.23 /usr/local/bin/python3.6 -m synapse.app.homeserver --daemonize -c /usr/local/etc/matrix-synapse/homeser
54694  -  SsJ     0:00.01 postgres: synapse_user synapse 10.1.1.8(49926)  (postgres)
54704  -  SsJ     0:00.01 postgres: synapse_user synapse 10.1.1.8(34813)  (postgres)
54898  -  SsJ     0:00.00 postgres: synapse_user synapse 10.1.1.8(35987)  (postgres)
55140  -  SsJ     0:00.00 postgres: synapse_user synapse 10.1.1.8(48412)  (postgres)
66998  -  SsJ     0:00.01 postgres: synapse_user synapse 10.1.1.8(17246)  (postgres)
71422  -  SsJ     0:09.22 /usr/local/bin/python3.6 -m synapse.app.homeserver --daemonize -c /usr/local/etc/matrix-synapse/homeser
71603  -  IsJ     0:00.14 postgres: synapse_user synapse 10.1.1.8(17671)  (postgres)
72397  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(39734)  (postgres)
72575  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(48464)  (postgres)
72821  -  IsJ     0:00.18 postgres: synapse_user synapse 10.1.1.8(33224)  (postgres)
73216  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(13992)  (postgres)
74282  -  IsJ     0:00.16 postgres: synapse_user synapse 10.1.1.8(33434)  (postgres)
78655  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(43654)  (postgres)
79232  -  IsJ     0:00.15 postgres: synapse_user synapse 10.1.1.8(43655)  (postgres)
87376  -  IsJ     0:00.13 postgres: synapse_user synapse 10.1.1.8(43663)  (postgres)
88057  -  IsJ     0:00.14 postgres: synapse_user synapse 10.1.1.8(43664)  (postgres)
37851  1  S+      0:00.00 tail -f /jails/matrix/var/log/matrix-synapse/homeserver.log
67732  2  R+      0:00.00 grep synapse
Please notice the process 71422 in both outputs. It looks like the process survived the jail restart (postgresql resides in another jail). As a result I have two synapse processes running with the same config in the jail, which just being restarted. BTW, if I restart the jail once again, I have three synapce processes...
So, basically I have two questions so far:
  1. Just out of curiosity, how is that possible - a residing in the jail process survives the jail restart. Is it common things and I missed something about jails? Or it is just for python (maybe another interpreter)?
  2. How to solve this? Meaning force the jail behave as it should, meaning the processes in the jail should be restarted as far as the jail is restarted.
EDIT: I have posted more details in another thread here on the forum
 
Thanks a much to Kevin P. Neal from the mailing list, the problem is solved.

It turns out, that I made a mistake in /etc/jail.conf - in the new jail section didn't wrap the IP in quotes, it looked like this:
Code:
$ip= 8 ;
It led to the duplicated jails with the same name "matrix" running with different unique JIDs. Obviously the service restart jail matrix command restarted only one jail with the same name. I wonder why the jail started and worked after all and didn't through in an error or at least warning. After I correcter the error and restarted the host a service restart jail matrix (or any other jail per se) gone flawless.
 
Back
Top