BDS not stopping gracefully when running as a service
Summary
BDS does not respond to standard server signals.
Steps to reproduce... (windows)
- Download and unzip BDS
- Download and unzip NSSM
- Configure BDS as a service and start - ensure you enable logging for easiest eval
- Stop the service using cmd/powershell/services.msc
- Note in the log that the server immediately terminates rather than running a safe shutdown
What I expected to happen...
BDS should handle the termination signal gracefully to allow BDS to be configured as a service.
What actually happened...
Server immediately terminated, risking corruption etc.
How this affects admins
At the moment its possible to configure BDS as a service and it works without issue. However when restarting the host or even just the service, it terminates immediately causing an unsafe shutdown and risking corruption.
Linked Issues
Comments8
History12
Added description:
Would be great to eventually have the Bedrock server more easily integrate with systemd/systemctl on Ubuntu, for starting on system boot-up, re-starting on failure, etc.
I can do it now, but it's kind of hack-y. For example, once systemd starts the Bedrock server, there's no good way to have it gracefully stop, it must kill the process.
Along the same line, if we're daemonizing ( ? ) the server, it'd be nice to have some way to attach to a running server in order to run commands.
Example : ./bedrock_server attach
I'd even settle for some way to run commands one-off, so I could properly shut down a running server.
Example : ./bedrock_server command stop
Thanks!
Removed environment:
Would be great to eventually have the Bedrock server more easily integrate with systemd/systemctl on Ubuntu, for starting on system boot-up, re-starting on failure, etc.
I can do it now, but it's kind of hack-y. For example, once systemd starts the Bedrock server, there's no good way to have it gracefully stop, it must kill the process.
Along the same line, if we're daemonizing ( ? ) the server, it'd be nice to have some way to attach to a running server in order to run commands.
Example : ./bedrock_server attach
I'd even settle for some way to run commands one-off, so I could properly shut down a running server.
Example : ./bedrock_server command stop
Thanks!
Added Confirmation Status: Unconfirmed
Added is duplicated by link: BDS-437Should handle SIGINT and SIGTERM signalsInvalid
Changed description:
Would be great to eventually have the Bedrock server more easily integrate with systemd/systemctl on Ubuntu, for starting on system boot-up, re-starting on failure, etc.
0I can do it now, but it's kind of hack-y. For example, once systemd starts the Bedrock server, there's no good way to have it gracefully stop, it must kill the process.
0Example : ./bedrock_server attach
0Example : ./bedrock_server command stop
0Thanks!
Summary
BDS does not respond to standard server signals.
Steps to reproduce... (windows)
- 0
- Download and unzip BDS
- Download and unzip NSSM
- Configure BDS as a service and start - ensure you enable logging for easiest eval 0
- Stop the service using cmd/powershell/services.msc 0
- Note in the log that the server immediately terminates rather than running a safe shutdown 0
What I expected to happen...
What actually happened...
How this affects admins
At the moment its possible to configure BDS as a service and it works without issue. However when restarting the host or even just the service, it terminates immediately causing an unsafe shutdown and risking corruption.
0Confirmation Status: Unconfirmed → Confirmed
Changed summary:
Added is duplicated by link: BDS-847SIGTERM doesn't make Ubuntu Bedrock Server save and quit gracefully.Duplicate
Added affects versions: 1.9.0.15 1.16.201.03 Hotfix
Resolution: Unresolved → Awaiting Response
Resolution: Awaiting Response → Unresolved
Resolution: Unresolved → Incomplete
Currently the way most server owners do this is by using the screen package. I will agree though, it would be nice if the server could detect that the operating system is shutting down and gracefully stop itself.
Thanks, Jacob. "screens" was a helpful tip.
Can either of you please provide steps on how to achieve this?
This comment gives an example: https://bugs.mojang.com/browse/BDS-56?focusedCommentId=490680&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-490680
I found this, which was written for the Java version, but adapted works for Bedrock too:
https://gist.github.com/justinjahn/4fe65b552b0622662420928cc8ffc7c0
I have had really good luck running the server in a docker container. https://github.com/cdunkelb/bedrocker
The report as it currently stands is more of a feature request (the ability to run BDS as a service etc) which need to be submitted over at the feedback site (https://feedback.minecraft.net).
However, the way BDS reacts when running as a service (not shutting down cleanly as described in
BDS-437- not obeying service termination signals) I would consider a bug .I've updated the summary to focus on that issue and confirmed the report.
Hi
Does this issue still occur after updating to 1.17.34?
This ticket will automatically reopen when you reply.
Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.
Quick Links:
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki