Skip to content

profiler-cli: record a session owner and refuse to stop others' sessions - #6268

Open
fqueze wants to merge 1 commit into
firefox-devtools:mainfrom
fqueze:profiler-cli-session-ownership-pr
Open

profiler-cli: record a session owner and refuse to stop others' sessions#6268
fqueze wants to merge 1 commit into
firefox-devtools:mainfrom
fqueze:profiler-cli-session-ownership-pr

Conversation

@fqueze

@fqueze fqueze commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

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.

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.
@fqueze
fqueze requested a review from canova August 18, 2026 11:37
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.73%. Comparing base (1198e50) to head (42bc174).
⚠️ Report is 42 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant