Remove stale KVM children and keep IOLoop responsive during connect#38
Open
nesvet wants to merge 1 commit into
Open
Remove stale KVM children and keep IOLoop responsive during connect#38nesvet wants to merge 1 commit into
nesvet wants to merge 1 commit into
Conversation
cadec3f to
3a3b3e5
Compare
3a3b3e5 to
431b878
Compare
Add cleanup_stale_kvm_children() and call it from start_kvm_container. Run blocking docker subprocess work in a thread pool so Tornado's IOLoop stays responsive during connect. Schedule additional_logging on the IOLoop from worker threads. Improve exit 125 error message when the noVNC port is already in use.
431b878 to
ec3d945
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the server stops without a clean WebSocket close, ephemeral
nojava-ipmi-kvmrc-*children can keep noVNC ports busy. The nextdocker runexits with return code 125 (port is already allocated).This PR unifies stale-child cleanup with non-blocking Docker I/O on the connect path.
Design
stale_children.pynojava-ipmi-kvmrc-*that are exited/dead or hold a host port in[WEB_PORT_START, WEB_PORT_END)start_kvm_container()cleanup_stale_kvm_children()via_run_blockingbeforedocker run_run_blockingrun_in_executorwrapper forsubprocess.call/Popenon the connect path (check_docker, cleanup, container launch,docker portpoll)log_factoryloop.call_soon_threadsafewhen forwardingadditional_loggingfrom executor threadsdocker_terminated_message()Test plan
docker rm[WEB_PORT_START, WEB_PORT_END)is not removedTested on ASUS ASMB8-iKVM firmware 1.14.2. After server restart with an orphaned child, cleanup runs on the next connect and the session starts without exit 125.
Requires sciapp/nojava-ipmi-kvm-server#9 for server startup / SIGTERM / atexit cleanup.
Related to sciapp/nojava-ipmi-kvm-server#7