Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix signals being ignored (#113) #114

Merged
merged 1 commit into from
Jun 26, 2023
Merged

fix signals being ignored (#113) #114

merged 1 commit into from
Jun 26, 2023

Conversation

nilsnolde
Copy link
Member

Previously when running the Valhalla service with e.g.:

$ docker run -v $PWD/data:/data ghcr.io/gis-ops/docker-valhalla/valhalla
...
INFO: Found config file. Starting valhalla service!
....

You couldn't stop it with Ctrl+C (SIGINT) or kill $! (SIGTERM) when run in the background, because the run.sh shell script didn't use exec for the valhalla_service command, which resulted in an intermediary shell process (that didn't pass the signals to child processes because Docker gives it PID 1, which is special1). This is a well-known pitfall of Docker ENTRYPOINT shell scripts.2

This commit fixes that oversight.

Sidenote: It still takes ~30 seconds for a SIGTERM to shutdown the server because valhalla_service has configured such a graceful shutdown period for the prime_server HTTP server.

Previously when running the Valhalla service with e.g.:

    $ docker run -v $PWD/data:/data ghcr.io/gis-ops/docker-valhalla/valhalla
    ...
    INFO: Found config file. Starting valhalla service!
    ....

You couldn't stop it with Ctrl+C (SIGINT) or `kill $!` (SIGTERM) when
run in the background, because the run.sh shell script didn't use `exec`
for the `valhalla_service` command, which resulted in an intermediary
shell process (that didn't pass the signals to child processes because
Docker gives it PID 1, which is special[1]).  This is a well-known
pitfall of Docker ENTRYPOINT shell scripts.[2][3]

This commit fixes that oversight.

Sidenote: It still takes ~30 seconds for a SIGTERM to shutdown
the server because valhalla_service has configured such a graceful
shutdown period for the prime_server HTTP server.

[1]: https://docs.docker.com/engine/reference/builder/#entrypoint
[2]: https://hynek.me/articles/docker-signals/
[3]: https://petermalmgren.com/signal-handling-docker/
@nilsnolde nilsnolde merged commit 2978b8b into 3.4.0 Jun 26, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants