diff --git a/Changelog.md b/Changelog.md index de72c36..da98965 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ * The latest OpenSSL updates have been pulled in. This fixes [CVE-2015-1793](http://openssl.org/news/secadv_20150709.txt). Upgrading is strongly recommended. * Removed nano and replaced vim with vim-tiny. This reduces Baseimage-docker's virtual size by 42 MB. + * Fixed an issue in `my_init` which could cause it to hang during shutdown. Thanks to Joe "SAPikachu" Hu for contributing the fix. Closes GH-151. * When `my_init` generates `/etc/container_environment.sh`, it now ensures that environment variable names do not include any characters unsupported by Bash. Unsupported characters are now replaced with underscores. This fixes compatibility issues with Docker Compose. Closes GH-230. * `my_init` no longer reads from and writes to `/etc/container_environment` if that directory does not exist. Previously it would abort with an error. This change makes it easier to reuse `my_init` in other (non-Baseimage-docker-based) projects without having to modify it. * Baseimage-docker no longer sets the HOME environment variable by default. We used to set HOME by default to work around [Docker issue 2968](https://github.com/docker/docker/issues/2968) where HOME defaults to /, but this issue is now fixed. Furthermore, the fact that we set HOME interfered with the USER stanza: USER would no longer set HOME. So we got rid of our HOME variable. Closes GH-231. diff --git a/image/bin/my_init b/image/bin/my_init index 325bff5..a023b2a 100755 --- a/image/bin/my_init +++ b/image/bin/my_init @@ -127,7 +127,10 @@ def waitpid_reap_other_children(pid): status = None while not done: try: - this_pid, status = os.waitpid(-1, 0) + # https://github.com/phusion/baseimage-docker/issues/151#issuecomment-92660569 + this_pid, status = os.waitpid(pid, os.WNOHANG) + if this_pid == 0: + this_pid, status = os.waitpid(-1, 0) if this_pid == pid: done = True else: