Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Fix stopping container with running xtail #63

Merged
merged 1 commit into from
Apr 22, 2019
Merged

Fix stopping container with running xtail #63

merged 1 commit into from
Apr 22, 2019

Conversation

vvolodko
Copy link
Contributor

@vvolodko vvolodko commented Apr 22, 2019

Running xtail in foreground and shiny-server in background lead to broken container shutdown on SIGTERM signal (ctrl-c).

Compare execution without xtail:

$ docker container run --rm -it -e APPLICATION_LOGS_TO_STDOUT=false   -p 3838:3838 rocker/shiny-verse:latest
[2019-04-22T04:33:18.211] [INFO] shiny-server - Shiny Server v1.5.11.924 (Node.js v8.11.3)
[2019-04-22T04:33:18.220] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2019-04-22T04:33:18.360] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2019-04-22T04:33:18.377] [INFO] shiny-server - Starting listener on http://[::]:3838
^C[2019-04-22T04:33:22.984] [INFO] shiny-server - Stopping listener on http://[::]:3838
[2019-04-22T04:33:22.985] [INFO] shiny-server - Shutting down worker processes (with notification)
$

and with xtail:

$ docker container run --rm -it -p 3838:3838 rocker/shiny-verse:latest

*** warning - no files are being watched ***
[2019-04-22T04:41:46.432] [INFO] shiny-server - Shiny Server v1.5.11.924 (Node.js v8.11.3)
[2019-04-22T04:41:46.436] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2019-04-22T04:41:46.540] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2019-04-22T04:41:46.549] [INFO] shiny-server - Starting listener on http://[::]:3838
^C
*** recently changed files ***
currently watching:  0 files  1 dirs  0 unknown entries
[2019-04-22T04:41:49.925] [INFO] shiny-server - Stopping listener on http://[::]:3838
[2019-04-22T04:41:49.925] [INFO] shiny-server - Shutting down worker processes (with notification)
^C(note: use "ctrl-\" SIQUIT to exit program)

*** recently changed files ***
currently watching:  0 files  1 dirs  0 unknown entries
^C(note: use "ctrl-\" SIQUIT to exit program)

*** recently changed files ***
currently watching:  0 files  1 dirs  0 unknown entries
^C(note: use "ctrl-\" SIQUIT to exit program)

*** recently changed files ***
currently watching:  0 files  1 dirs  0 unknown entries
^\
$

The patch always exec shiny-server as container's main process and run xtail in background. So, both processes stop on SIGTERM as expected.

Always exec shiny-server as container's main process and run `xtail` in background. So, both processes stop on SIGTERM as expected.
@cboettig
Copy link
Member

Nice, that looks reasonable to me.

@cboettig cboettig merged commit 6316c34 into rocker-org:master Apr 22, 2019
@vvolodko vvolodko deleted the fix-stop-container-on-sigterm branch April 22, 2019 05:16
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants