1
0
mirror of /repos/baseimage-docker.git synced 2025-12-30 08:01:31 +01:00

Fix a potential hang in my_init during shutdown

Thanks to SAPikachu. Closes GH-151.
This commit is contained in:
Hongli Lai (Phusion) 2015-07-15 17:35:45 +02:00
parent 23d0a30e59
commit 7425da2825
No known key found for this signature in database
GPG Key ID: 2AF96EB85EF4DA0D
2 changed files with 5 additions and 1 deletions

View File

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

View File

@ -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: