Skip to content

fix(sensing-server): handle WebSocket Lagged + add ping keepalive#484

Open
schwarztim wants to merge 1 commit intoruvnet:mainfrom
schwarztim:pr/websocket-keepalive-fix
Open

fix(sensing-server): handle WebSocket Lagged + add ping keepalive#484
schwarztim wants to merge 1 commit intoruvnet:mainfrom
schwarztim:pr/websocket-keepalive-fix

Conversation

@schwarztim
Copy link
Copy Markdown

Motivation

Dashboard WebSocket clients were rapid-cycling (connect/disconnect every 2-4s) under load. Root cause: the broadcast channel raises RecvError::Lagged when a slow consumer falls behind the 256-frame buffer (10 Hz ingest × 50-200 KB frames makes this easy to hit), which the handler treated as a fatal error and closed the connection. Long idle periods also let proxies time out the connection.

Changes

  • v2/crates/wifi-densepose-sensing-server/src/main.rs: catch RecvError::Lagged in both handle_ws_client and handle_ws_pose_client and continue (drop missed messages, log debug); add 30s ping keepalive on the sensing handler.

Test results

  • cargo test --workspace --no-default-features: 1621 passed, 0 failed
  • python v1/data/proof/verify.py: pre-existing hash mismatch on this environment (numpy/scipy version); not caused by this change (confirmed identical failure on unmodified origin/main)
  • Manual: dashboard maintains connection through sustained UDP ingest at 30Hz

Notes

  • No new dependencies, no API changes, no ADR needed.
  • Cherry-picked from fork commit 581daf4f with automatic path adjustment (rust-port/v2/).

Root cause: broadcast channel Lagged error caused instant disconnect
when clients fell behind 256 frames (10Hz * 50-200KB = easy to lag).
Client reconnects, immediately lags again, rapid cycling ensues.

Sensing handler: Lagged error now continues (skips missed frames)
instead of breaking. Added 30s ping interval for proxy keepalive.
Pose handler: same Lagged handling + Pong match arm.

CHANGELOG updated under Unreleased/Fixed.
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