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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Jazzlover
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/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`

```
  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 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
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"
Reply | Threaded
Open this post in threaded view
|

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

James Gritton-2
On 2019-09-18 13:15, Jazzlover wrote:

> 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`
>
> ```
>
> 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.

It looks like you've answered #2 yourself, but this is still something
that shouldn't be happening.  The only time stopping a jail should
result in the jail still existing with old processes is if those
processes end up completely unkillable (which generally points to a
different problem).

I wonder if leaving the rc system out of entirely, and just restarting
via jail(8) would change anything.  Does a "jail -rc jailname" give any
different results?

> 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
>> 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 ;

This fix worries me, because that doesn't look like a line the requires
quoting (unless you want the spaces to be part of the value).  Also, the
fact that the unquoted value caused the symptoms it did without any
error messages is wrong even if quoting the value fixes it.

I'd like to see the entire jail.conf, and see if I can reproduce and
pinpoint this problem.

- Jamie
_______________________________________________
[hidden email] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-jail
To unsubscribe, send any mail to "[hidden email]"