fix(skillfs): ensure SLS ops log written even on SIGPIPE panic#1507
Open
zhangtaibo wants to merge 1 commit into
Open
fix(skillfs): ensure SLS ops log written even on SIGPIPE panic#1507zhangtaibo wants to merge 1 commit into
zhangtaibo wants to merge 1 commit into
Conversation
skillfs CLI list/classify subcommands don't write SLS ops log entries when stdout is piped to a consumer that closes early (e.g. head -5). println! panics on broken pipe, killing the process before log_command() runs. Add SlsLogGuard RAII guard that calls log_command() in Drop, ensuring SLS entry is written on all exit paths including panic unwinds. Fixes alibaba#1506 Signed-off-by: zhangtaibo <zhangtaobo.ztb@alibaba-inc.com>
|
zhangtaibo seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
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.
问题
Fixes #1506
skillfs CLI subcommands
listandclassifydo not write SLS ops log entries when stdout is piped to a consumer that closes early (e.g.head -5). Thelog_command()call runs after allprintln!output, butprintln!panics on broken pipe (SIGPIPE/EPIPE) when the downstream reader has already exited, causing the process to unwind before reachinglog_command().This is a regression from the original SLS ops logging fix (commit 1a07b20, issue #1306). The
log_commandcalls were added to all subcommands, but they are unreachable when the process panics from a broken stdout pipe.修复
Add an RAII
SlsLogGuardthat callssls_ops::log_command()in itsDropimplementation. The guard is created before the command runs and dropped on all exit paths — including panic unwinds from broken pipe. This ensures the SLS entry is always written regardless of stdout pipe state.Each command handler replaces its manual
log_commandcall with guard creation:验证
Co-Authored-By: Claude noreply@anthropic.com