{"record":{"id":"c0f80142ebc9ae16","repo":"vectordotdev/vector","slug":"pong-not-received-in-time","errorCode":null,"errorMessage":"Pong not received in time","messagePattern":"Pong not received in time","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sinks/websocket/sink.rs","lineNumber":68,"sourceCode":"            ping_timeout: config.common.ping_timeout,\n        })\n    }\n\n    async fn create_sink_and_stream(\n        &self,\n    ) -> (\n        impl Sink<Message, Error = TungsteniteError> + use<>,\n        impl Stream<Item = Result<Message, TungsteniteError>> + use<>,\n    ) {\n        let ws_stream = self.connector.connect_backoff().await;\n        ws_stream.split()\n    }\n\n    fn check_received_pong_time(&self, last_pong: Instant) -> Result<(), TungsteniteError> {\n        if let Some(ping_timeout) = self.ping_timeout\n            && last_pong.elapsed() > Duration::from_secs(ping_timeout.into())\n        {\n            return Err(TungsteniteError::Io(io::Error::new(\n                io::ErrorKind::TimedOut,\n                \"Pong not received in time\",\n            )));\n        }\n\n        Ok(())\n    }\n\n    async fn handle_events<I, WS, O>(\n        &mut self,\n        input: &mut I,\n        ws_stream: &mut WS,\n        ws_sink: &mut O,\n    ) -> Result<(), ()>\n    where\n        I: Stream<Item = Event> + Unpin,\n        WS: Stream<Item = Result<Message, TungsteniteError>> + Unpin,\n        O: Sink<Message, Error = TungsteniteError> + Unpin,","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/src/sinks/websocket/sink.rs#L50-L86","documentation":"Runtime error from the WebSocket sink's connection supervision in src/sinks/websocket/sink.rs. The sink sends pings and records the last pong time; `check_received_pong_time` compares `last_pong.elapsed()` against the configured `ping_timeout` and, when exceeded, returns a tungstenite `Error::Io` with kind `TimedOut` (\"Pong not received in time\"). This tears down the connection and triggers the sink's reconnect-with-backoff loop.","triggerScenarios":"The remote WebSocket endpoint stops answering protocol-level pings (RFC 6455 pong frames) for longer than `ping_timeout` seconds: dead/unresponsive server, half-open TCP connection, silent network drop, or a proxy stripping ping/pong frames.","commonSituations":"WebSocket servers that don't implement pong replies; intermediaries (nginx, cloud LBs) with idle timeouts closing the connection quietly; mobile/flaky networks where the connection dies without a FIN; `ping_timeout` set lower than real round-trip times.","solutions":["Increase `ping_timeout` on the WebSocket sink so legitimate latency can't trip it","Confirm the server answers RFC 6455 pings (most frameworks do automatically; custom servers may not)","Check proxies/LBs between Vector and the server for idle-timeout kills or filtered ping/pong frames","Rely on the built-in reconnect: after this error the sink re-establishes the connection with backoff, so a one-off blip self-heals"],"exampleFix":"# before\n[sinks.out]\ntype = \"websocket\"\nuri = \"wss://example.com/ws\"\nping_timeout = 5 # too tight, trips on normal latency\n\n# after\n[sinks.out]\ntype = \"websocket\"\nuri = \"wss://example.com/ws\"\nping_timeout = 30","handlingStrategy":"retry","validationCode":"# Smoke-test that the endpoint answers pings before shipping\n# (any RFC 6455 client with ping/pong enabled; a stalled pong = server-side problem)","typeGuard":null,"tryCatchPattern":"loop {\n    match run_sink_session(&mut input).await {\n        Err(TungsteniteError::Io(ref e)) if e.kind() == std::io::ErrorKind::TimedOut => {\n            // pong timeout: reconnect with backoff (the sink's built-in behavior)\n            backoff.wait().await;\n        }\n        Err(e) => return Err(e),\n        Ok(()) => break,\n    }\n}","preventionTips":["Set ping_timeout comfortably above worst-case RTT plus server pong latency","Confirm the server and any proxies forward WebSocket ping/pong frames","Rely on the sink's reconnect-with-backoff; alert on repeated timeouts, not the first one"],"tags":["rust","websocket","ping-pong","timeout","network","vector-sink"],"backgroundTag":"websocket-ping-timeout","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}