I’ve got a bit of a problem where my builds do not seem to be finishing like ever.
I do see all the build steps exiting in the build logs but still the build stays in “running” state. No relevant logs found either on server or agent. Agent is started with DRONE_DEBUG=true env and I can see the build start event there but nothing more. In some of the cases eventually the UI shows:
ERROR: terminal inactive for 15m0s, build cancelled
While doing some debugging on this, it seems that some of the output from docker-compose commands come “out-of-place”. I mean that in the build logs I didn’t see all the output done events that it prints out but still saw the exit code.
This makes me think if the issue could be that agent sees some of the output AFTER the command has already exited and thus thinks the step is still alive?
I was able to workaround the issue by using the commands like so:
This is hanging your shell because it is waiting for docker-compose to complete. If you run the below script on a linux system it will hang indefinitely waiting for the backgrounded process to complete:
#!/bin/bash
python -m SimpleHTTPServer 8000 &
echo started
exit 0
This is unfortunately a bash (on Linux) issue. It won’t exit a script if there are processes still running in the background.
I don’t think the output is the root cause. The difference is that you are stopping the docker-compose processes, allowing the terminal to exit.
The issue I don’t get is that how could bash have processes on the background as the containers are spawned on the host side as I’m mounting the hosts docker socket to the build container? See:
bash-4.3# docker-compose up -d --build
Building web
(output omitted)
Successfully built fa8a1d925302
workspace_mongodb_1 is up-to-date
Starting workspace_web_1
bash-4.3# ps faux
PID USER TIME COMMAND
1 root 0:00 bash
31 root 0:00 ps faux
As you see, there’s no background processes in the container running at all.