Skip to content

test: Chrome profile crash test can claim the profile before the killed process group exits #420

Closed

Description

@ElbertePlinio

packages/browser/test/integration.test.ts > "real headed Chrome under Xvfb" > "persists a real Chrome login cookie across teardown and recovers after a crash" failed once in a full bun run test:coverage run on a loaded local host:

Error: Browser profile "ops" is held by session brow-96436077
 ❯ acquire packages/browser/src/profiles.ts:266:15
 ❯ claimBrowserProfile packages/browser/src/profiles.ts:329:5
 ❯ startBrowserSession packages/browser/src/session.ts:669:22
 ❯ packages/browser/test/integration.test.ts:149:21

The same test passed 3 times in a row when run alone on the same revision.

Likely cause: after process.kill(-second.browserPid, "SIGKILL"), the test waits only until the leader pid is gone. ownerAlive in packages/browser/src/profiles.ts:168 also counts the process group as alive through isProcessGroupAlive, and under load other Chrome processes in the group can take longer to exit. The third createBrowserSession then still sees the owner as alive.

Found while running the full suite for #367, which does not touch the browser package.

  • Wait until the whole process group is gone before the third session, or make the claim wait briefly for a group that is already exiting
  • Keep the assertion that a live owner still refuses the profile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions