Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Sep 2019 21:15:49 +0200
From:      Jazzlover <jazzlover@gmx.net>
To:        freebsd-jail@freebsd.org
Subject:   A process survives a restart of the jail in which the process reside. How so?
Message-ID:  <0f6de6a5-c588-e324-67c3-db43c8bb03bb@gmx.net>

next in thread | raw e-mail | index | archive | help
Hello there,

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`

```
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/homese=
r
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`

```
  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/homese=
r
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/homese=
r
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 synapse 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.

I have posted more details in another thread here on the FreeBSD.org forum=
:
https://forums.freebsd.org/threads/py36-matrix-synapse-installation-almost=
-working.72257/post-439752



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0f6de6a5-c588-e324-67c3-db43c8bb03bb>