profiler-cli: record a session owner and refuse to stop others' sessions - #6268
Open
fqueze wants to merge 1 commit into
Open
profiler-cli: record a session owner and refuse to stop others' sessions#6268fqueze wants to merge 1 commit into
fqueze wants to merge 1 commit into
Conversation
One session directory is shared by every profiler-cli process on the machine, and "the current session" is a single file in it that any caller's "load" can move, so a mis-aimed "stop" destroys a profile someone else is using. Each session now records its creator -- PROFILER_CLI_SESSION_OWNER, else the parent pid -- and "stop" refuses one owned by another, naming the owner and exiting 1. "session list" shows owner and age. BEHAVIOUR CHANGE: "stop <id>" exits 1 where it exited 0 for a session created by a different owner, and "stop --all" reaches only your own sessions. --force restores the old behaviour. Sessions with no owner recorded, with unreadable owner metadata, or owned by a pid that has provably exited stay stoppable by anyone, so nothing is stranded. Only ESRCH releases a pid owner: EPERM means a live process we may not signal.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6268 +/- ##
=======================================
Coverage 83.73% 83.73%
=======================================
Files 350 350
Lines 37523 37524 +1
Branches 10543 10538 -5
=======================================
+ Hits 31420 31421 +1
Misses 5676 5676
Partials 427 427 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Main | Deploy preview
One session directory is shared by every profiler-cli process on the machine, and "the current session" is a single file in it that any caller's "load" can move, so a mis-aimed "stop" destroys a profile someone else is using. Each session now records its creator -- PROFILER_CLI_SESSION_OWNER, else the parent pid -- and "stop" refuses one owned by another, naming the owner and exiting 1. "session list" shows owner and age.
BEHAVIOUR CHANGE: "stop " exits 1 where it exited 0 for a session created by a different owner, and "stop --all" reaches only your own sessions. --force restores the old behaviour.
Sessions with no owner recorded, with unreadable owner metadata, or owned by a pid that has provably exited stay stoppable by anyone, so nothing is stranded. Only ESRCH releases a pid owner: EPERM means a live process we may not signal.