-
Notifications
You must be signed in to change notification settings - Fork 74
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
dashd not gracefully shutdown when used with docker-compose #36
Comments
@c0deright How are you shutting down via Are you pushing Ctrl+C twice b/c the first one doesn't react? That will force the kill signal early, which could result in the behaviour that you see. Docker-compose behaviour is documented here: https://docs.docker.com/compose/faq/#can-i-control-service-startup-order |
|
Yep, I think I see what's going on. I'm mostly guessing here, but it seems that your dashcore-node (Node.js) process which spawns dashd is the main Docker process, and once that's died (via SIGTERM), the Docker daemon kills all other processes and shuts down the container. It's possible the Node.js process is handling SIGINT but not SIGTERM in the same way. But really this is not super relevant, because your Node.js process shouldn't be spawning dashd anyway. The Docker way is to use one process per container. If your Docker container used only dashd and controlled the dashd process (without the Node.js layer), this would not be an issue. Docker is meant to manage these processes itself, not delegate thru another layer. This
I disabled printing to console here so that you can inspect the debug.log in the volume after the fact and see that it's shutting down properly:
We also removed support for dashcore-node spawning a dashd process and only support an external dashd install at any rate. The fact that the Node.js was downloading and managing it's own dashcore instance led to tight coupling of components and really is a terrible architecture. At the time it didn't exist (at least with such good support), but Docker is actually the correct way to do what dashcore-node (actually parent project bitcore-node) is trying to do -- manage necessary dependencies and wire them together properly. I'm currently making an effort to remove this repo entirely and not rely on this architecture. |
Note: I've added a gist w/this docker-compose file and instructions for verifying proper DashCore shutdown behaviour: https://gist.github.com/nmarley/c154596915071960ce3a09d8d8513b26 Please feel free to run this using the instructions and see if it works for you. |
Hi, I just followed the documentation to get insight-api running with dashcore and that's using letting dashcore spawn the dashd process. I'm pretty sure, as you said, if I would seperate the dashd process from the nodejs app (both in their own docker-container) things will work as intended. I might follow that path, yes, but since I'm not using the wallet (disablewallet=1 in dash.conf) for the insight-api there is currently no downside in dashd being KILLED and not being shutdown gracefully. Just wanted to raise that issue here so others stumbling over it will find some resources. |
In 4.0.0 'spawn' is still supported for service
Isn't this repo still needed even when |
No, this should never have been implemented in this manner at all really. The purpose of dashcore-node is to do what Docker does now, only this project does it terribly and is a bad architecture. We need to instead set up Insight to not need this and be able to run as its own service, instead of being We'll have to do a release soon to merge |
I've built a docker image consisting of dashcore-node that spawns the
dashd
process.When started via
docker run -it image-name
the current shell keeps being attached to the docker process so that later pressing key combo CTRL+C results in dashd gracefully shutting down. This can be confirmed by looking at dashd's debug.log which containsas the last entry.
When using docker-compose however upon stopping the container dashd is SIGKILLED, debug.log has no entry about shutting down and the berkeleydb directory "database" is still present in dashd's datadir which is a clear indication that no graceful shutdown happened.
I can only guess that dashcore-node has to handle SIGNALs here for a graceful shutdown of the spawned
dashd
.The text was updated successfully, but these errors were encountered: