phusion / baseimage-docker

A minimal Ubuntu base image modified for Docker-friendliness
http://phusion.github.io/baseimage-docker/
MIT License
8.96k stars 1.09k forks source link

`my_init` crashes entire Mac OS 10.9.2 system #47

Closed pda closed 10 years ago

pda commented 10 years ago

Running my_init on Mac OS 10.9.2 crashes the entire system, dumping it to a blank grey screen and requiring a reboot.

Warning, by the nature of this issue, running the examples may crash your system.

This first happened when I invoked my_init from Mac OS to test exit status fixes for #45:

python my_init --skip-runit -- bash -c "exit 42"

A simpler and more universal test-case:

URL="https://raw.githubusercontent.com/phusion/baseimage-docker/master/image/my_init"
curl $URL | /usr/bin/python

I get the same crash with:

I realize Mac OS isn't the target system for this program, but it'd be nice to be able to test e.g. exit status bugs on any python-capable system, and the crash is very strange.

pda commented 10 years ago

Oh, right…

finally:
    if args.kill_all_on_exit:
        kill_all_processes(KILL_ALL_PROCESSES_TIMEOUT)
def kill_all_processes(time_limit):
    info("Killing all processes...")
    try:
        os.kill(-1, signal.SIGTERM)

That'd do it :)

It's possible that my_init should only kill its own child / descendant processes. But in the normal use-case, that's the entire system, so perhaps there's no need to add that complexity.

FooBarWidget commented 10 years ago

Yes. Don't run my_init except in a container. It's specifically designed for use in a Docker container.

FooBarWidget commented 10 years ago

I tend to test my_init like this:

docker run -t -i -v `pwd`/image:/image phusion/baseimage:xxx /image/my_init [...]
pda commented 10 years ago

Makes sense :)