Keep the restart_workers monitor alive on transient errors (and drop debug prints)#694
Open
lollinng wants to merge 1 commit into
Open
Keep the restart_workers monitor alive on transient errors (and drop debug prints)#694lollinng wants to merge 1 commit into
lollinng wants to merge 1 commit into
Conversation
The restart_workers watchdog wrapped its entire while loop in a single try/except, so any exception in one iteration (e.g. a transient worker->API mapping error or a failed relaunch) exited the loop and killed the monitor thread, silently disabling self-healing for the rest of the server's life. Move the try/except inside the loop so one bad iteration is logged and the watchdog keeps running. Also replace the leftover '[monoriting]' debug prints with logger calls. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
The
restart_workerswatchdog in_start_worker_monitoring.monitor()wraps its entirewhile not self._shutdown_event.is_set()loop in a singletry/except:So if any single iteration raises — a transient worker→API mapping error, a failed
launch_single_inference_worker, etc. — the exception breaks out of thewhileloop, the monitor thread exits, andrestart_workersself-healing is permanently disabled for the rest of the server's lifetime. The loop also shipped three leftover debug prints (misspelled[monoriting]).Fix
Move the
try/exceptinside the loop so a single bad iteration is logged (logger.exception) and the watchdog keeps monitoring. Replace the[monoriting]debug prints withloggercalls. The intentionalreturnonrestart_workers=False(graceful shutdown) is preserved.Verification
Modeled both control-flow shapes with a body that raises once then succeeds: