crazy-max / docker-dokuwiki

DokuWiki Docker image
MIT License
43 stars 19 forks source link

Containers do not shut down properly #29

Closed apollo13 closed 3 years ago

apollo13 commented 3 years ago

Behaviour

A sudo time docker stop -t 15 wiki takes 15 seconds to execute, which seems to indicate that the container needed to be killed

Steps to reproduce this issue

sudo docker run -d --name wiki crazymax/dokuwiki:edge
sudo time docker stop --time 15 wiki
wiki
0.05user 0.01system 0:15.28elapsed 0%CPU (0avgtext+0avgdata 59948maxresident)k
128inputs+0outputs (1major+7511minor)pagefaults 0swaps

The container process seems to shut down quickly:

2021/02/20 10:54:25 [notice] 494#494: signal 15 (SIGTERM) received from 487, exiting
[20-Feb-2021 10:54:25] NOTICE: Terminating ...
2021/02/20 10:54:25 [notice] 530#530: exiting
2021/02/20 10:54:25 [notice] 569#569: exiting
2021/02/20 10:54:25 [notice] 591#591: exiting
2021/02/20 10:54:25 [notice] 542#542: exiting
2021/02/20 10:54:25 [notice] 534#534: exiting
2021/02/20 10:54:25 [notice] 532#532: exiting
2021/02/20 10:54:25 [notice] 529#529: exiting
2021/02/20 10:54:25 [notice] 531#531: exiting
2021/02/20 10:54:25 [notice] 569#569: exit
2021/02/20 10:54:25 [notice] 531#531: exit
2021/02/20 10:54:25 [notice] 534#534: exit
2021/02/20 10:54:25 [notice] 529#529: exit
[20-Feb-2021 10:54:25] NOTICE: exiting, bye-bye!
2021/02/20 10:54:25 [notice] 542#542: exit
2021/02/20 10:54:25 [notice] 591#591: exit
2021/02/20 10:54:25 [notice] 530#530: exit
2021/02/20 10:54:25 [notice] 532#532: exit
2021/02/20 10:54:25 [notice] 494#494: signal 17 (SIGCHLD) received from 529
2021/02/20 10:54:25 [notice] 494#494: worker process 529 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: worker process 531 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: worker process 532 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: signal 29 (SIGIO) received
2021/02/20 10:54:25 [notice] 494#494: signal 17 (SIGCHLD) received from 569
2021/02/20 10:54:25 [notice] 494#494: worker process 569 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: signal 29 (SIGIO) received
2021/02/20 10:54:25 [notice] 494#494: signal 17 (SIGCHLD) received from 534
2021/02/20 10:54:25 [notice] 494#494: worker process 534 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: signal 29 (SIGIO) received
2021/02/20 10:54:25 [notice] 494#494: signal 17 (SIGCHLD) received from 530
2021/02/20 10:54:25 [notice] 494#494: worker process 530 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: signal 29 (SIGIO) received
2021/02/20 10:54:25 [notice] 494#494: signal 17 (SIGCHLD) received from 591
2021/02/20 10:54:25 [notice] 494#494: worker process 542 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: worker process 591 exited with code 0
2021/02/20 10:54:25 [notice] 494#494: exit

but from the looks of it not all processes got reaped:

➜  ~ sudo docker exec wiki ps -ef
PID   USER     TIME  COMMAND
    1 root      0:00 s6-svscan -t0 /var/run/s6/services
  721 root      0:00 s6-supervise socklog/log
  723 root      0:00 s6-supervise socklog
  728 nobody    0:00 socklog unix /dev/log
  729 nobody    0:00 s6-log -bp - +^cron\. T /var/log/socklog/cron - +^daemon\. T /var/log/socklog/daemon - +^\.debug: T /var/log/socklog/debug - +\..err: +\.error: +\.emerg: +\.alert: +\.crit: T /var/log/socklog/errors + -auth\. -authpriv\. T /var/log/socklog/everything - +^kern\. T /var/log/socklog/kernel - +^mail\. T /var/log/socklog/mail - +\.info: +\.notice: +\.warn: -^auth\. -^authpriv\. -^mail\. -^news\. -^cron\. T /var/log/socklog/messages - +^auth\. +^authpriv\. T /var/log/socklog/secure - +^user\. T /var/log/socklog/user
  742 dokuwiki  0:00 inotifywait -m /data/plugins /var/www/lib/plugins /data/tpl /var/www/lib/tpl
  744 dokuwiki  0:00 {watch_folders} /bin/sh /usr/local/bin/watch_folders
 1061 root      0:00 ps -ef

Expected behaviour

Container should shut down cleanly

Actual behaviour

Container only shut down after stop time elapsed

Configuration

crazy-max commented 3 years ago

@apollo13 Thanks for your report, looks like inotifywait cannot handle SIGTERM signal.

crazy-max commented 3 years ago

@apollo13 Actually that's an issue with s6-overlay. Image has been updated with s6-overlay 2.1.0.2 in the meantime.