fix(server): stop bare excepts from swallowing cancellation and shutdown - #1557
Open
harshadkhetpal wants to merge 1 commit into
Open
fix(server): stop bare excepts from swallowing cancellation and shutdown#1557harshadkhetpal wants to merge 1 commit into
harshadkhetpal wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Harshad Khetpal <harshadkhetpal@users.noreply.github.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.
Summary
Replaces the 18 bare
except:clauses inlightllm/server/(ruff E722). A bare except catchesBaseException, which in an async serving stack silently swallowsasyncio.CancelledError,KeyboardInterrupt, andSystemExit— 8 of these sites are inhttpserver_for_pd_master/manager.py, on the PD-master request lifecycle (abort fallbacks, status updates, request-table cleanup), where an eaten cancellation can leak or hang a request instead of unwinding it.Chosen replacements:
except Exception:for the 15 intentional catch-and-continue sites — identical behavior for all ordinary errors, but cancellation/shutdown now propagates.except (AttributeError, TypeError):for the twochat_templatecapability probes inbuild_prompt.py(the only failures attribute probing produces).except OSError:for the temp-fileunlinkcleanup inembed_cache/afs_utils.py.Testing
python -m py_compilepasses on all nine files;ruff check --select E722onlightllm/server/goes from 18 errors to clean. No functional change for ordinary exceptions — onlyBaseException-family propagation is restored.🤖 Generated with Claude Code