Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright test runner hangs when using the webServer option #25193

Closed
nathanwhit opened this issue Aug 24, 2024 · 2 comments · Fixed by #25218
Closed

Playwright test runner hangs when using the webServer option #25193

nathanwhit opened this issue Aug 24, 2024 · 2 comments · Fixed by #25218
Labels
bug Something isn't working correctly node compat

Comments

@nathanwhit
Copy link
Member

When using the webServer option in a playwright config, the playwright test runner hangs and won't exit without CTRL-C.

// playwright.config.js
import { defineConfig } from "@playwright/test";
export default defineConfig({
  webServer: { // without this option, it exits cleanly
    command: `deno run -A server.ts`,
  },
});

Repro: https://github.com/nathanwhit/deno-playwright-hang-repro. Run deno task test

@nathanwhit nathanwhit added bug Something isn't working correctly node compat labels Aug 24, 2024
@lucacasonato
Copy link
Member

lucacasonato commented Aug 26, 2024

Processing the strace-ops log shows that these are the pending async ops. I presume one of them ref'd when it's meant to be unref'd?

Map(3) { "op_signal_poll" => 1, "op_spawn_wait" => 1, "op_read" => 2 }

It is not op_signal_poll, so it must either be op_spawn_wait or one of the two op_read ops.

@nathanwhit
Copy link
Member Author

nathanwhit commented Aug 26, 2024

The root cause turned out to be us not implementing the detached option in child_process.spawn.

Creating a detached process makes a new process group, which then you can kill with process.kill(-child.pid) to kill the whole group. Since we hadn't actually detached the process, the kill call was throwing (because the negative pid signifies the process group, which didn't exist) and playwright was catching the error and didn't have a fallback. So the subprocess was never actually killed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants