[Bug] Docker signal handling not working
- Dominant language
- Java
- Stars
- 6.4k
- Forks
- 1.2k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 115
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.
### Version
iotdb 1.3.1-standalone
### Describe the bug and provide the minimal reproduce step
When stoping a docker container running the apache/iotdb:1.3.1-standalone image the SIGTERM signal handling trap is not executed leading to a non graceful shut down. This is because the entrypoint.sh script uses `exec` which destroys signal handlers using `trap.`
Furthermore, the function that should be executed at SIGTERM 'on_stop' defined in entrypoint.sh has the if statement `"$start_what"` != "all".` Therfore in standalone mode the corresponding graceful shutdown is not executed.
To reproduce run the docker container and then stop it.
### What did you expect to see?
The on_stop function defined in entrypoint.sh is executed when the docker container is stopped providing a graceful shutdown with FLUSH.
### What did you see instead?
Rapid shut down without proper SIGNAL handling and without execution of the on_stop function.
### Anything else?
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
Research direction
Start by reading entrypoint.sh, especially the exec usage and the on_stop function. Run the standalone Docker image and stop the container to reproduce the signal-handling behavior. Done means stopping the container invokes on_stop and performs the expected graceful shutdown with FLUSH.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, shell
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100