Skip to content

fix(microservices): suspend incomplete packet timers during backpressure - #17989

Merged
kamilmysliwiec merged 1 commit into
nestjs:masterfrom
jackie-cqz:fix/tcp-backpressure-timeout
Oct 2, 2026
Merged

kamilmysliwiec merged 1 commit into
nestjs:masterfrom
jackie-cqz:fix/tcp-backpressure-timeout

Conversation

@jackie-cqz

Copy link
Copy Markdown
Contributor

PR Checklist

  • Commit message follows the contribution guidelines.
  • Regression tests added.
  • Docs updated (no documentation files changed).

PR Type

  • Bugfix
  • Feature

What is the current behavior?

Outgoing backpressure pauses inbound processing, leaving complete received frames buffered. The incomplete-packet timer treats that buffer as a stalled partial packet and destroys the connection. A timer armed before reads are paused has the same problem.

What is the new behavior?

Suspend incomplete-packet timers while reads are paused for outgoing backpressure. Rearm after drain only if a partial packet remains. Regressions verify complete buffered frames survive a prolonged pause, and a genuinely partial packet still times out after drain.

Does this PR introduce a breaking change?

No.

Validation

  • npx vitest run packages/microservices/test/helpers/json-socket.spec.ts: 21 tests passed.
  • Unit suite: 305 files, 3778 tests passed; two existing Windows-incompatible SIGTERM tests excluded by name.
  • npm run build: passed.
  • npm run lint and git diff --check: passed, with the existing optional-chain warning in socket-module.ts.
  • TCP shutdown, reconnect, pipelining and memory-bound integration suites: 11 tests passed.

This branch contains one independent change based on 7fb52e7f4f7314fbc117e369a09297bc2ecadf6b.

@kamilmysliwiec
kamilmysliwiec merged commit 0d95f2b into nestjs:master Oct 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants