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

Propagate signals to launch.sh and fully await shutdown #47

Merged
merged 1 commit into from
Sep 4, 2024

Conversation

Oldsouldier
Copy link
Contributor

This fully completes the passing of docker shutdown signals to the game executable. (Completes #46) Prior to this, the signals were not being passed from entry.sh to launch.sh. Another alternative is to merely source entry.sh from launch.sh and make launch.sh the actual dockerfile command.

Also, after some testing, i noticed some lost progress when shutting down the world. Delaying the termination of xvfb by waiting within the trap handler seemed to eliminate this problem for me.

@Oldsouldier
Copy link
Contributor Author

Another possible explanation of why this works better is that the wait at the bottom of launch.sh is interrupted by the signals received (once exec was added to entry.sh), so the 1 second sleep was not enough wait for the process to shut down prior to the container terminating. The additional wait in the trap handler provides the necessary delay.

@Oldsouldier Oldsouldier changed the title Propogate signals to launch.sh and delay xvfb shutdown Propogate signals to launch.sh and fully await shutdown Sep 4, 2024
@arguser
Copy link
Collaborator

arguser commented Sep 4, 2024

Hello @Oldsouldier, thank you for the PR. Yesterday we merged a PR adding tini for passing signals, thanks to @solareon

Doesn't that solves this issue?

@arguser
Copy link
Collaborator

arguser commented Sep 4, 2024

What do you think GOAT @Micke90s ?

@Oldsouldier
Copy link
Contributor Author

@arguser It was part of the solution, but does not produce the desired outcome. I added echo statements in the trap handler in launch.sh and they were not printing until i added the exec call in entry.sh.

Furthermore, even after the signal was being caught, i noticed loss of progress when shutting down due to the wait call being interrupted by the signal (my current theory). This is a known behavior of wait. The additional call to wait allows time for a complete shutdown, which is the entire point of the signal passing in the first place.

@Oldsouldier Oldsouldier changed the title Propogate signals to launch.sh and fully await shutdown Propagate signals to launch.sh and fully await shutdown Sep 4, 2024
@arguser arguser merged commit 92dbf3b into escapingnetwork:main Sep 4, 2024
1 check failed
@Micke90s
Copy link
Contributor

Micke90s commented Sep 4, 2024

@Oldsouldier: Thank you for the detailed explanation and your pull request. Works perfect 👍
Just saw that the server even would wait for the last player to leave before stop.

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.

3 participants