Playwright tunnel stop can hang while waiting for connection

Open
#5,853 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
64/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
tooling

Research direction

Locate PlaywrightTunnel.stopAsync() and _pollConnectionAsync(), then trace how the pending poll promise and _initWsPromise behave when stopping in waiting-for-connection mode. Reproduce a stop before any WebSocket connects and verify that stopAsync() settles, pending poll state is cleared, and the tunnel reaches stopped status.

Written by the indexing model from the issue text.

Description

Summary

PlaywrightTunnel.stopAsync() can hang when the tunnel is stopped while it is still waiting for a poll-connection client to arrive.

Why this is a separate issue

The current PR (#5851) fixes a Start/Stop lifecycle race by waiting for an in-progress stop before starting again. That does not address the case where Stop itself never settles while the tunnel is still in waiting-for-connection / poll-connection mode.

Suspected root cause

In poll-connection mode, _pollConnectionAsync() returns a promise that only resolves after a WebSocket connection succeeds. stopAsync() clears the polling interval, but it still awaits _initWsPromise, which can remain unresolved forever if Stop happens before a connection arrives.

Proposed fix shape

  • Add a cancellation/settle path for the pending poll promise when stopping.
  • Ensure stopAsync() can complete even if no WebSocket ever connected.
  • Clear any pending poll state and set status to stopped as part of stop teardown.

Evidence

A local gws auth login flow now reaches a clean timeout when the VS Code extension never connects, which suggests the remaining stall is in the extension stop path rather than the remote side.

Dominant language
TypeScript
Stars
6.5k
Forks
708
Avg merge
5d 19h
Merged PRs (30d)
48

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/rushstack

All issues in microsoft/rushstack

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.