Report shared and service workers ending as page_worker_ended, not page_crashed - #436
Open
archandatta wants to merge 3 commits into
Open
archandatta wants to merge 3 commits into
archandatta wants to merge 3 commits into
Conversation
Chromium sends Inspector.targetCrashed on a shared worker's session when the worker ends and on a service worker's session when it is stopped. The monitor mapped every targetCrashed to page_crashed, so sessions that never crashed reported crashes. Worker targets now emit a new worker_ended event; every other target keeps page_crashed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r case Every other page-category event is page_*. Dedicated workers never send Inspector.targetCrashed, so only shared and service workers map to the new event. Document that data from earlier images can still carry page_crashed for worker targets, and that idle service workers are not stopped while the monitor holds a session on them. The real-Chromium crash check now SIGKILLs the renderers instead of sending Page.crash, so it does not wait on Chrome's crash handler. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tants alone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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
handleTargetCrashednow emits a newpage_worker_endedevent (categorypage, withtarget_id,target_typeandurl) forshared_workerandservice_workertargets. Every other target type keeps emittingpage_crashed.BrowserPageWorkerEndedEventtoopenapi.yamland to theKnownBrowserTelemetryEventunion, and regeneratesoapi.goandcategory_gen.goTestPageWorkerEndedChrome, and runs it in the CI "CDP telemetry browser regressions" steppage_crashedandpage_worker_endedin the cdpmonitor READMEWhy
The monitor mapped every
Inspector.targetCrashedtopage_crashed. Only three DevTools agent hosts in Chromium send that notification:RenderFrameDevToolsAgentHost::RenderProcessExitedsends it only when the renderer terminates abnormally (crashed, killed or failed to launch). These are real crashes.SharedWorkerDevToolsAgentHost::WorkerDestroyedsends it every time a shared worker ends.ServiceWorkerDevToolsAgentHost::WorkerStoppedsends it every time a service worker stops.Dedicated workers, worklets, tabs and the browser target never send it. Because the monitor attaches to shared and service workers with
Target.attachToTarget, sessions that never crashed reported apage_crashedeach time one of those workers ended, which buried real renderer crashes.Checked against real Chromium with the monitor attached:
self.close()page_crashedpage_worker_endedpage_crashedpage_worker_endedpage_crashedpage_worker_endedServiceWorker.stopAllWorkerspage_crashedpage_worker_endedpage_crashed×2page_crashed(page) +page_worker_ended(worker)Idle service workers are not stopped while a DevTools session is attached.
ServiceWorkerVersionskips idle termination whendevtools_attached()is true, and the monitor holds a session on every service worker. So idle timeouts do not produce this event; the schema and README say so.CDP gives no way to tell a worker that ended normally from one whose process died, so both produce
page_worker_ended. When a renderer dies, the pages it hosted still reportpage_crashed.Unchanged
page_worker_ended. A stopped service worker restarts on the same session and target, and the e2e test checks that its network telemetry keeps flowing and that its next stop reports the event again.page_crashedon page, iframe and background_page targets, and on untracked sessions (target_type: other), behaves as before. Thepage_crashedschema description notes that data from earlier images can still contain workerpage_crashedevents.page_crashedstays ERROR andpage_worker_endedgets the default INFO. Both are pinned inTestToLogRecord_Severity.Generated code
The new schema pins its const names with
x-enum-varnames. oapi-codegen v2's enum-collision pass compares names that may already carry a prefix, so adding another enum with the valuepagechanges which existing enums get prefixed: without the pin, the existing unusedoapi.Pageconst is renamed. With the pin, the regeneratedoapi.goonly adds code; the only removed line is thepage_crasheddescription this PR edits. Regenerating unmodifiedmainproduces no diff.The public API schema change is kernel/kernel#4615. The API passes unknown event types through on read, so the order in which the two land does not matter.
Testing
go vet ./...— cleango test -race $(go list ./... | grep -v /e2e$)— all packages passKERNEL_CDPMONITOR_CHROME_E2E=1 go test -race -count=1 ./lib/cdpmonitor— the full real-Chromium suite passesTestPageWorkerEndedChromepassed 10/10 under-raceon Ubuntu Chromium 154 and 10/10 on Chrome for Testing 154.0.8037.92 (the version CI installs), using CI's exact-runfilter.page_crashedfails the shared and service worker subtests, and routing page and iframe targets topage_worker_endedfails the renderer-crash subtest plusTestTargetCrashed.SystemInfo.getProcessInfo. An earlier version usedPage.crash, which goes through Chrome's crash handler; it passed locally but timed out once in CI, wherefindChromiummay pick up a different binary.TestTargetCrashedByTargetType(fake CDP server) coversshared_workerandservice_worker→page_worker_endedandiframe→page_crashed, and asserts that the session stays tracked.🤖 Generated with Claude Code