Skip to content

chore(headless): drop dead chrome pid kill code - #2761

Open
dogancanbakir wants to merge 1 commit into
devfrom
chore/headless-dead-pid-code
Open

dogancanbakir wants to merge 1 commit into
devfrom
chore/headless-dead-pid-code

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Fixes #2760

Comments only. Checked on macOS: after a SIGKILL of httpx during a screenshot, its Chrome processes exit, so the PID kill fallback is not needed. Conflicts with #2559 are expected; I will rebase after it lands.

Summary by CodeRabbit

  • Updates
    • Browser startup now uses an installed browser on local setups and systems detected as using musl; other environments continue to use the downloaded Chromium browser.
    • When an installed browser is required but unavailable, browser startup now returns an error instead of proceeding.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Headless browser startup uses Leakless. Browser selection uses an installed browser when useLocal is true or the host is detected as musl; otherwise, it uses go-rod’s downloaded Chromium. The change also removes commented-out Chrome PID tracking and cleanup code.

Changes

Headless browser lifecycle

Layer / File(s) Summary
Browser selection, startup, and cleanup
runner/headless.go
Browser selection uses an installed browser for local-browser or musl hosts. Startup enables Leakless(true). The code removes commented-out Chrome PID tracking and cleanup. Browser.Close still closes the browser engine and removes the temporary directory.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • projectdiscovery/httpx#2734: Moves screenshot and browser code to the ProjectDiscovery rod fork, whose process-group cleanup is cited as the basis for removing the PID-kill code.
Merge Risk: Minimal · up to dea5e

This PR deletes dead, commented-out Chrome PID-kill code and its TODO, so runtime behavior is unchanged. There is no identified merge risk.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Out of Scope Changes check Inconclusive The PR description and the linked issue describe a deletion-only change: removing the commented-out PID-kill code and TODO in runner/headless.go. The AI-generated summary reports +0/-8 lines for runne… Provide the base-to-head text diff for runner/headless.go (or make the changed blobs available) so the changed hunks can be compared against the PR scope. Confirm that the musl-detection, browser-selection, Leakless, and network-policy code…
Passed Passed checks: 3 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "chore(headless): drop dead chrome pid kill code" matches the main change. The PR removes the commented-out Chrome PID-kill code and its TODO from runner/headless.go, which the linked issue …
Linked Issues check Passed [#2760] requires removing the commented-out Chrome PID-kill code and its TODO from runner/headless.go. The reviewed head version of runner/headless.go contains no PID-kill code, no commented-out PID-k…
Full details: Title check

Explanation

The title "chore(headless): drop dead chrome pid kill code" matches the main change. The PR removes the commented-out Chrome PID-kill code and its TODO from runner/headless.go, which the linked issue #2760 requests. The title names the file scope (headless) and the removed code. The raw summary also lists related browser-selection and musl-detection changes that the title does not mention, but the removal of dead PID-kill code is the primary objective.

Full details: Linked Issues check

Explanation

[#2760] requires removing the commented-out Chrome PID-kill code and its TODO from runner/headless.go. The reviewed head version of runner/headless.go contains no PID-kill code, no commented-out PID-kill block, and no related TODO. Browser startup uses launcher.New().Leakless(true), and the Browser struct has no PID field. The issue's premise (the projectdiscovery/rod fork terminates the browser process group) is the rationale for removal; this PR does not change that premise. The PR description reports a macOS check that Chrome exits after SIGKILL of httpx. That check is author-reported and was not reproduced here. No coding requirement remains unmet in the reviewed head.

Full details: Out of Scope Changes check

Explanation

The PR description and the linked issue describe a deletion-only change: removing the commented-out PID-kill code and TODO in runner/headless.go. The AI-generated summary reports +0/-8 lines for runner/headless.go, which fits that scope. However, the same summary describes present-tense changes to browser selection (preferSystemBrowser, hostUsesMusl, muslHost, glibc/musl loader matching, NewBrowser error on missing Chrome) and to Leakless(true) startup. These changes are not mentioned in the PR description. The diff could not be read because changed blobs are missing from the checkout. The base revision of runner/headless.go was not read, so it is not established whether these changes are present in the merge base or introduced by this PR. The reviewed head file also contains network-policy, request-hijacking, and header-handling code that the PR description does not mention. Scope cannot be decided without the base-to-head diff.

Resolution

Provide the base-to-head text diff for runner/headless.go (or make the changed blobs available) so the changed hunks can be compared against the PR scope. Confirm that the musl-detection, browser-selection, Leakless, and network-policy code exists at the merge base and is not added by this PR. If any of these hunks are added here, either justify them against the linked issue or remove them.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the browser’s trail
Leakless starts it without a tail
Old PID notes are swept away
The browser closes at end of day
Musl hosts choose an installed way

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 455b7833-19d7-496e-9f43-d0ba3f318e0a
Commits

Reviewing files that changed from the base of the PR and between 200e6ff and dea5efc.

Files selected for processing: 1

  • runner/headless.go
Files with no reviewable changes: 1

  • runner/headless.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

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.

Remove dead Chrome PID kill code from headless

1 participant