Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Actually when I have sent the question I had systemd-222. now it is 223 and result is the same. Unit file is at http://webczatnet.pl/webczat/appserver.service W dniu 2015-07-30 o 05:36, Andrei Borzenkov pisze: В Wed, 29 Jul 2015 21:17:18 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello. I am trying to use systemd to run wildfly application server. It is being run by a shell script that runs a java vm in a separate process. So, killing the script does not kill the other process. The service is a simple type service, and I am wondering what happens there on stop. when the server receives signal sigint or sigterm directly it logs some messages about it being stopped. However, when I start it and then stop, this does not happen, i get no message as if it was killed by sigkill. What may happen? the documentation says that the systemd sends sigterm to all processes by default (if KillMode=control-group and this is probably default), and then sigkill if processes do not respond for a configured amount of time. In this case sigterm sent to the shell script (the main process) causes it to exit, but then appserver is probably sigkilled. I know that setting sendSIGKILL to no makes it shudown normally. What is going on? Could you post your unit file and which version of systemd? -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBAgAGBQJVuh3eAAoJEHb1CzgxXKwY1fIQAJKIxvtH1+9c00osb86JCR0z uTmj1vfrNCgrwNTAHcMlopAnVwFauyBuMP79/R5All0m8iZZpnQKhjUSz7h0Sl0Q IWVMlRtbZyqIjkwF4FTM1OkvqSkhuOmsXviqvfJtpAjuyAxfOcLJAQohnhA62jwA JqlNKUmSlKocwmAH3IIc3TxZn6NnDo0jBCZ8QkOQisCycpcShTMPyCbwUvShemj8 gLpBkOUkPVCjGZV3GFNBoN5rEvLjZtMVVB8+DzeM5NU5B9bodCuMJ8e4GKmuJh+V yCaS/XG7WCSZrq2C1VSBjQYipZYpgBUee2Dhg5m3xRV3TvhhgPFIwaOaw6OApqeY 8zXEwniP14LLiFcSbWW4sZmfwR3ZjFH3o+bQWK0ROBDzFn99iI+L3Tx83H6wDFxh 0j9OlQpCIodtJZ2yU8FybZ6tMdR/NRQCbYogI94QUEGfhXuKFdL4Od3RbmvB6dOy USvWfQFXVZe3TQ6tal8544QQ+CX5OQpbye3npihlk9qSkiGIhNvAhAr/DZwRz/uO MQdeHfddje1D0cDx0Wvu4BjJTCLQEOUz2K9YbYNM9Qx7JAuQDCQxfsqoz4m8mhPp Nh7MKjPvHpVvCaCluQOuCrOKI79hi2Owq7imWxrqBanEuG84AM3PVJKQCURYS06M BIKXEd/KN2sPj/cl3sYE =JhUy -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks, tracking it. W dniu 2015-07-30 o 20:41, Andrei Borzenkov pisze: В Thu, 30 Jul 2015 20:07:03 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Here is a log from appserver.service: appserver.service: Trying to enqueue job appserver.service/stop/replace appserver.service: Installed new job appserver.service/stop as 16578 appserver.service: Enqueued job appserver.service/stop as 16578 appserver.service: Changed running - stop-sigterm Stopping java application server... appserver.service: Child 19079 belongs to appserver.service appserver.service: Main process exited, code=killed, status=15/TERM appserver.service: Changed stop-sigterm - dead Stopped java application server. appserver.service: Child 19142 belongs to appserver.service appserver.service: cgroup is empty appserver.service: cgroup is empty What happens with the other child? You are likely facing variant of https://github.com/systemd/systemd/issues/317 First SIGTERM kills your parent shell immediately. For systemd it means service is stopped and it enters final SIGTERM. Now it does not wait for child to stop but rather immediately sends final SIGKILL. Either your parent needs to wait until child exits, or you should get rid of parent so that Java process is main process for systemd. Or you can revert commit mentioned in issue :) -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBAgAGBQJVuoXMAAoJEHb1CzgxXKwYJocP/1PG3XrYCAd5D6fYqXCWh6zb nC2ihbQNJlQ/D71y2AbGfpf2lMan24WlD7T8FEQlYRoPw7o3BqBvTSCaxtR+DulT Ez26o/qH9/ga1i/4bQ73Dr9UzS5hmWGGSBw1puqjQVNnR5zJuIlYXQzPH4NjwNV7 Rne/3+1JH8pC6AUzNUj8QVQNndNphIrpxkRC4h++OCcU2njZ0G7UcXCkFVGjAjxr 6Cqx87MN9dQ9q4ek15nRyNpkUYwpdGTTj5nDOibXXVlKaJSJ4OhUwXRotxWAYBrH uG7Ig49lUEhkIulK9BO5AnBZj8wU2jmBLiaNEUU6ulZIpYOlKJncJ/lFuUTWZgrd 1nBrNSXRx9wM8wTsJ0RYdl7IRZcm+V23WTWyMGNxYDgiyhfjLlzHkiVzW8Z6BCfj jjtlkg+vNe1ZAytCTMZIrHk3g7E9rqNg4O63pPdz0L80tvKlKYDSA1hK1nZ7g2Hb qy4P4sr0dWvTFb0gxrklXEPu9wfQQRiaGig1wbyCBu9i5C+309HWFgpupbRIA6cV /MLFwkMJYYPcP01MWJeVpAUfr7vwKTnDB7uheqbVDJi4MjdMyEApYpskm54cPL8g sD9GhCgEmn+sjJJkOW3lnXUKN2Ee/4uMCA52FkG1DiCUyuaUG0t556qp0faTac2q 8sQ9gNuOQRsCGRR1m3su =0Mfx -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 В Thu, 30 Jul 2015 14:51:44 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Actually when I have sent the question I had systemd-222. now it is 223 and result is the same. Unit file is at http://webczatnet.pl/webczat/appserver.service By default systemd also sends SIGHUP right away; how your service reacts to it? You can enable systemd debugging (/bin/kill -RTMIN+22 1), stop service and look at logs or post here. P.S. KillSignal=SIGTERM is default and redundant W dniu 2015-07-30 o 05:36, Andrei Borzenkov pisze: В Wed, 29 Jul 2015 21:17:18 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello. I am trying to use systemd to run wildfly application server. It is being run by a shell script that runs a java vm in a separate process. So, killing the script does not kill the other process. The service is a simple type service, and I am wondering what happens there on stop. when the server receives signal sigint or sigterm directly it logs some messages about it being stopped. However, when I start it and then stop, this does not happen, i get no message as if it was killed by sigkill. What may happen? the documentation says that the systemd sends sigterm to all processes by default (if KillMode=control-group and this is probably default), and then sigkill if processes do not respond for a configured amount of time. In this case sigterm sent to the shell script (the main process) causes it to exit, but then appserver is probably sigkilled. I know that setting sendSIGKILL to no makes it shudown normally. What is going on? Could you post your unit file and which version of systemd? -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBAgAGBQJVuh3eAAoJEHb1CzgxXKwY1fIQAJKIxvtH1+9c00osb86JCR0z uTmj1vfrNCgrwNTAHcMlopAnVwFauyBuMP79/R5All0m8iZZpnQKhjUSz7h0Sl0Q IWVMlRtbZyqIjkwF4FTM1OkvqSkhuOmsXviqvfJtpAjuyAxfOcLJAQohnhA62jwA JqlNKUmSlKocwmAH3IIc3TxZn6NnDo0jBCZ8QkOQisCycpcShTMPyCbwUvShemj8 gLpBkOUkPVCjGZV3GFNBoN5rEvLjZtMVVB8+DzeM5NU5B9bodCuMJ8e4GKmuJh+V yCaS/XG7WCSZrq2C1VSBjQYipZYpgBUee2Dhg5m3xRV3TvhhgPFIwaOaw6OApqeY 8zXEwniP14LLiFcSbWW4sZmfwR3ZjFH3o+bQWK0ROBDzFn99iI+L3Tx83H6wDFxh 0j9OlQpCIodtJZ2yU8FybZ6tMdR/NRQCbYogI94QUEGfhXuKFdL4Od3RbmvB6dOy USvWfQFXVZe3TQ6tal8544QQ+CX5OQpbye3npihlk9qSkiGIhNvAhAr/DZwRz/uO MQdeHfddje1D0cDx0Wvu4BjJTCLQEOUz2K9YbYNM9Qx7JAuQDCQxfsqoz4m8mhPp Nh7MKjPvHpVvCaCluQOuCrOKI79hi2Owq7imWxrqBanEuG84AM3PVJKQCURYS06M BIKXEd/KN2sPj/cl3sYE =JhUy -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYFAlW6T4UACgkQR6LMutpd94xHNACeOeApGc3kFQJEKocW42iVZaUA O0gAoKNEiP+6Rd6IOnigeMH/2vei71bX =c0jF -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 В Thu, 30 Jul 2015 20:07:03 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Here is a log from appserver.service: appserver.service: Trying to enqueue job appserver.service/stop/replace appserver.service: Installed new job appserver.service/stop as 16578 appserver.service: Enqueued job appserver.service/stop as 16578 appserver.service: Changed running - stop-sigterm Stopping java application server... appserver.service: Child 19079 belongs to appserver.service appserver.service: Main process exited, code=killed, status=15/TERM appserver.service: Changed stop-sigterm - dead Stopped java application server. appserver.service: Child 19142 belongs to appserver.service appserver.service: cgroup is empty appserver.service: cgroup is empty What happens with the other child? You are likely facing variant of https://github.com/systemd/systemd/issues/317 First SIGTERM kills your parent shell immediately. For systemd it means service is stopped and it enters final SIGTERM. Now it does not wait for child to stop but rather immediately sends final SIGKILL. Either your parent needs to wait until child exits, or you should get rid of parent so that Java process is main process for systemd. Or you can revert commit mentioned in issue :) -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYFAlW6b9kACgkQR6LMutpd94w/pACgvnPjF3xVms4D0qv9i24MlnRh 8ukAoMJhioFyh3/n6uDX9w21l24T5Fxk =5S47 -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 First, it seems that sighup is NOT sent by default. Second, setting SendSIGKILL to no fixes the problem (and that should not be needed), that probably means the second process gets sigkill. W dniu 2015-07-30 o 18:23, Andrei Borzenkov pisze: В Thu, 30 Jul 2015 14:51:44 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Actually when I have sent the question I had systemd-222. now it is 223 and result is the same. Unit file is at http://webczatnet.pl/webczat/appserver.service By default systemd also sends SIGHUP right away; how your service reacts to it? You can enable systemd debugging (/bin/kill -RTMIN+22 1), stop service and look at logs or post here. P.S. KillSignal=SIGTERM is default and redundant W dniu 2015-07-30 o 05:36, Andrei Borzenkov pisze: В Wed, 29 Jul 2015 21:17:18 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello. I am trying to use systemd to run wildfly application server. It is being run by a shell script that runs a java vm in a separate process. So, killing the script does not kill the other process. The service is a simple type service, and I am wondering what happens there on stop. when the server receives signal sigint or sigterm directly it logs some messages about it being stopped. However, when I start it and then stop, this does not happen, i get no message as if it was killed by sigkill. What may happen? the documentation says that the systemd sends sigterm to all processes by default (if KillMode=control-group and this is probably default), and then sigkill if processes do not respond for a configured amount of time. In this case sigterm sent to the shell script (the main process) causes it to exit, but then appserver is probably sigkilled. I know that setting sendSIGKILL to no makes it shudown normally. What is going on? Could you post your unit file and which version of systemd? -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBAgAGBQJVumWUAAoJEHb1CzgxXKwYRVYP/jrbXjV7QurkHN7nnNHIPOAb omX3xbPlrRe0IdgmIQkguXwKPRPueiuNx4mILqFZXhEVwjGGhpA4/zoGVXnKk5gH JPWOZmklDMLQZCTerlWsXGI5B+ze/apFdTMmeLnl9vhuOnubvOO5qReL8z/2MB6N iOjgijKtBRV+w66XcmaGHnfwkkIyO1J+kaEhHLqDpp97S1X3cys8FGyXRQejt6Zv Nusr3OP3iWRn382eXwh47gDSGFuNQVtCkLwMRXeVOXOGM0O+dclUNvYBClPirOpg lM3kgbYC4Z6l11ZfzICDDIaY25l46gobbW+L9e+SWouNkhmTaPgF9yzdwT1M6HXw nnsOAZMbXoCGwj41bhttZnILQ5KW1CrqEB3Y5KzSR5J7BAMyeJOTVYPWD5gUtwj5 KR5wtHMLbjgyk8+rcMMXwVIsx7NH3drEHkKhTO/tz8kuqDUxkV6pdZNSLj5Y5PRv vwgd0KQdvkE2s7cqHvfcTSrVxgh7wpYCmZ2/SiDTDhYXkaSAE3szAqLhrtW1It9f 61ePhMfkZIz8B5U8Y2DWZecE1aMZqvrtSSKDZlQ38+msDEwn2noprbiPBXyzSjJ4 wQ3pi5P/kfR1pTq9ESUX7IUgo9f9TfOawLOR6baF3oulbgUjOxce0HSCO8yo9wJi SURkDNoRLPLjR0zOPb4d =BVTb -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Here is a log from appserver.service: appserver.service: Trying to enqueue job appserver.service/stop/replace appserver.service: Installed new job appserver.service/stop as 16578 appserver.service: Enqueued job appserver.service/stop as 16578 appserver.service: Changed running - stop-sigterm Stopping java application server... appserver.service: Child 19079 belongs to appserver.service appserver.service: Main process exited, code=killed, status=15/TERM appserver.service: Changed stop-sigterm - dead Stopped java application server. appserver.service: Child 19142 belongs to appserver.service appserver.service: cgroup is empty appserver.service: cgroup is empty What happens with the other child? I have tested that killing the shell process normally does not kill the child, only the reverse, so... W dniu 2015-07-30 o 18:23, Andrei Borzenkov pisze: В Thu, 30 Jul 2015 14:51:44 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Actually when I have sent the question I had systemd-222. now it is 223 and result is the same. Unit file is at http://webczatnet.pl/webczat/appserver.service By default systemd also sends SIGHUP right away; how your service reacts to it? You can enable systemd debugging (/bin/kill -RTMIN+22 1), stop service and look at logs or post here. P.S. KillSignal=SIGTERM is default and redundant W dniu 2015-07-30 o 05:36, Andrei Borzenkov pisze: В Wed, 29 Jul 2015 21:17:18 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello. I am trying to use systemd to run wildfly application server. It is being run by a shell script that runs a java vm in a separate process. So, killing the script does not kill the other process. The service is a simple type service, and I am wondering what happens there on stop. when the server receives signal sigint or sigterm directly it logs some messages about it being stopped. However, when I start it and then stop, this does not happen, i get no message as if it was killed by sigkill. What may happen? the documentation says that the systemd sends sigterm to all processes by default (if KillMode=control-group and this is probably default), and then sigkill if processes do not respond for a configured amount of time. In this case sigterm sent to the shell script (the main process) causes it to exit, but then appserver is probably sigkilled. I know that setting sendSIGKILL to no makes it shudown normally. What is going on? Could you post your unit file and which version of systemd? -BEGIN PGP SIGNATURE- Version: GnuPG v2 iQIcBAEBAgAGBQJVumfFAAoJEHb1CzgxXKwYCWwQAMM5jqB4btrIlUJbfRYyMC1o q8K5bAMadVDw5PmdZkcJrly7cEsvC1JcTumt/0O/OPeRfIe6W2cCTmulLJWe3XCM v6ixN3NCBTW6BqxSGDtW4A5v7KWs6cTlLPzgzsAtPf+oiz31l34IZ0xVWdpd06Zt Sh0Vj65+wKFX3DEGo3dq0illwZySRXV7Yf5r42cJUINRe/cO8pvF/8uIao7KUmAa 2WYfy7T3zCc/wkMmb5kayh/8F8sYYzrLBKaN6NbNlgMhTdV3Mri81Jz78TEJuwUn LYI8Koi0VEhUWFRvdEgyqMJoChs1jdXWvLtbuuFm00hjcDBQq4LOujz5/qMK7K9D KgTgcJof5+dJaSG10MC3VxBUSijcNtAEuk7VuNlbH7KSzUwdOk0ntIo++6Bsaj4e V/n4xrD08SlTXRM6MMruVNApqPcEvRjriDHTJjLLKE+Q0clnwoawCUBzGCq5hgKh H7IfPd36NxDbSYQKojAzZ8g6gUCkO5zNGG3ZRolK2k1LZX755KSv3+gcp6iNkoPO FKF4uFF34CcyPxzc29+nQ2M2555A7uZJo4Bm2aCT2/0b++WIrI2SdYC6wRt12U66 E411ZK5/4ROZrwFIkwICoFcMCGVTssR62AO7sHyJy6K58c92wyslhfM/HcuGqbJ4 kamXEs1kkTkQLIUiwOCR =A1is -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 В Thu, 30 Jul 2015 19:57:42 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 First, it seems that sighup is NOT sent by default. Yes, sorry, my mistake. Second, setting SendSIGKILL to no fixes the problem (and that should not be needed), that probably means the second process gets sigkill. It does not explain what happens. Debug logs may help. -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYFAlW6Z90ACgkQR6LMutpd94wJMgCgmzVB0vSpYx36iGJvliyVlAa3 lkIAoK65zwuHL1S1sYwLNEfP6O0Asfkc =oEWb -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] behavior of stop in case of multiple processes
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 В Wed, 29 Jul 2015 21:17:18 +0200 Michał Zegan webczat_...@poczta.onet.pl пишет: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello. I am trying to use systemd to run wildfly application server. It is being run by a shell script that runs a java vm in a separate process. So, killing the script does not kill the other process. The service is a simple type service, and I am wondering what happens there on stop. when the server receives signal sigint or sigterm directly it logs some messages about it being stopped. However, when I start it and then stop, this does not happen, i get no message as if it was killed by sigkill. What may happen? the documentation says that the systemd sends sigterm to all processes by default (if KillMode=control-group and this is probably default), and then sigkill if processes do not respond for a configured amount of time. In this case sigterm sent to the shell script (the main process) causes it to exit, but then appserver is probably sigkilled. I know that setting sendSIGKILL to no makes it shudown normally. What is going on? Could you post your unit file and which version of systemd? -BEGIN PGP SIGNATURE- Version: GnuPG v2 iEYEARECAAYFAlW5m74ACgkQR6LMutpd94xHcgCgquo2XGHk348JRxeXcUHJR/yu fjcAoJrusCMl/PHMI69cmx2A0p4gkPfV =qtmw -END PGP SIGNATURE- ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel