habitat-sh / habitat

Modern applications with built-in automation
https://www.habitat.sh
Apache License 2.0
2.61k stars 315 forks source link

init hook returning invalid exit code #1222

Closed mattray closed 8 years ago

mattray commented 8 years ago

After upgrading to the latest habitat (0.9.1/20160901213157) the polipo docker export starting failing. After building from the current core-plans/polipo and exporting to docker I got this error

$ docker run -p 8123:8123 mattray/polipo
hab-sup(MN): Starting mattray/polipo
hab-sup(TP): Child process will run as user=hab, group=hab
hab-sup(GS): Supervisor 172.17.0.3: 7b9ff8d8-5b42-4034-9846-19243dbe1231
hab-sup(GS): Census polipo.default: 471d91f2-b423-4fdc-be5d-90fe8e73bbda
hab-sup(GS): Starting inbound gossip listener
hab-sup(GS): Starting outbound gossip distributor
hab-sup(GS): Starting gossip failure detector
hab-sup(CN): Starting census health adjuster
hab-sup(SC): Updated polipo.config
hab-sup(TP): Restarting because the service config was updated via the census
hab-sup(PH)[src/package/hooks.rs:121:16]: Hook failed to run: init, 1, Failed

Doing a straight hab pkg export docker core/polipo produces the same result. Adding debugging to the init made the error go away.

#!/bin/sh
#

mkdir -p {{pkg.svc_path}}/cache/
mkdir -p {{pkg.svc_path}}/www/
echo $?

I added an echo $? to see if the mkdir -p was throwing an error (it wasn't). It produces

$ docker run -p 8123:8123 mattray/polipo
hab-sup(MN): Starting mattray/polipo
hab-sup(TP): Child process will run as user=hab, group=hab
hab-sup(GS): Supervisor 172.17.0.3: fbb19c50-7965-40e2-bbc8-79ecb1de747c
hab-sup(GS): Census polipo.default: ba20a84f-d1e6-4bf8-ac29-488ee5b311d9
hab-sup(GS): Starting inbound gossip listener
hab-sup(GS): Starting outbound gossip distributor
hab-sup(GS): Starting gossip failure detector
hab-sup(CN): Starting census health adjuster
hab-sup(SC): Updated polipo.config
hab-sup(TP): Restarting because the service config was updated via the census
init(PH): 1
polipo(SV): Starting

I'm stumped but wondered if something changed in the hook handling code recently that might have caused this?

mattray commented 8 years ago

/me fails at reading exit codes