Skip to content

fix(eio-client): resume polling when an upgrade probe fails during pause - #5651

Open
amstedy wants to merge 1 commit into
socketio:mainfrom
amstedy:fix/engine-io-client-upgrade-probe-abort
Open

amstedy wants to merge 1 commit into
socketio:mainfrom
amstedy:fix/engine-io-client-upgrade-probe-abort

Conversation

@amstedy

@amstedy amstedy commented Dec 1, 2026

Copy link
Copy Markdown

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behavior

After receiving 3probe, Socket._probe() sets this.upgrading = true and calls this.transport.pause(...). If the probe transport fails or closes before pause() finishes, freezeTransport() sets failed = true and closes the probe, causing the pause callback to return early without resetting this.upgrading or resuming the polling transport. Outgoing packets (including pong) remain stuck in writeBuffer and polling stays paused until the connection dies with ping timeout.

New behavior

  • Add a no-op Transport.resume() hook and implement Polling.resume() to cancel an in-flight pause (pollComplete/drain listeners), restore readyState = "open", and restart _poll() only when no poll is already in flight and the socket is not closing/closed (guarding onData() with !this._polling to avoid overlapping GET requests).
  • Track probe-owned upgrade state inside Socket._probe() so that when the active probe fails after 3probe, onerror clears this.upgrading (and resets Socket.priorWebsocketSuccess for "websocket"), resumes the existing transport before emitting upgradeError, and flushes writeBuffer if the socket is not closed.
  • Add regression tests in packages/engine.io-client/test/node.js covering probe termination and clean close during pause(), probe failure after pollComplete while a POST is in flight, deferred socket.close() with and without buffered packets, and synchronous probe close during the upgrading event.

Other information (e.g. related issues)

Fixes #5650

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.

[engine.io-client] a probe that fails after its pong leaves "upgrading" on: the socket sends nothing until the ping timeout

1 participant