Skip to content

v3.0.3: cap socket.io reconnects + monitor cleanup on terminal failure#66

Merged
perki merged 1 commit into
pryv:masterfrom
healthdatasafe:fix/socket-io-reconnect-cap
May 4, 2026
Merged

v3.0.3: cap socket.io reconnects + monitor cleanup on terminal failure#66
perki merged 1 commit into
pryv:masterfrom
healthdatasafe:fix/socket-io-reconnect-cap

Conversation

@perki
Copy link
Copy Markdown
Member

@perki perki commented May 4, 2026

Defense-in-depth on top of v3.0.2's websocket-only fix. Three changes:

@pryv/socket.io

  • io() now passes reconnectionAttempts: 10, reconnectionDelayMax: 60000, randomizationFactor: 0.5. socket.io-client defaults are infinite attempts at ≤5s — one stuck client could drive ~17k req/day per tab. With these settings the client gives up after ~10 attempts spread over ~1 minute.
  • New reconnect_failed listener tears down the underlying _io and emits error so consumers can clean up instead of leaving a zombie socket reference.

@pryv/monitor

  • UpdateMethod/Socket.js error handler now drops this.socket if the underlying _io has been torn down. A future Changes.READY will rebuild from scratch instead of short-circuiting on the dead handle.

Other

  • npm audit fix (non-breaking) — 15 → 5 vulnerabilities. The remaining 5 need --force / major version bumps in dev deps; out of scope for this PR.

Tests: just test pryv-socket.io (10 pass), just test pryv-monitor (24 pass).

Validated end-to-end by publishing v3.0.3 to npm and bumping consumers; no regression observed in production deployment.

Defense-in-depth on top of v3.0.2's websocket-only fix. Three changes:

@pryv/socket.io
- io() now passes reconnectionAttempts: 10, reconnectionDelayMax: 60000,
  randomizationFactor: 0.5. socket.io-client defaults are infinite
  attempts at <=5s — one stuck client could drive ~17k req/day per tab.
  With these settings the client gives up after ~10 attempts spread over
  ~1 minute.
- New 'reconnect_failed' listener tears down the underlying _io and
  emits 'error' so consumers can clean up instead of leaving a zombie
  socket reference.

@pryv/monitor
- UpdateMethod/Socket.js error handler now drops this.socket if the
  underlying _io has been torn down. A future Changes.READY will
  rebuild from scratch instead of short-circuiting on the dead handle.

Plus npm audit fix (non-breaking) — 15 → 5 vulnerabilities (the
remaining 5 need --force / major version bumps in dev deps; out of
scope for this PR).
@perki perki merged commit 3852c53 into pryv:master May 4, 2026
1 check failed
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.

1 participant