{"record":{"id":"8f2f20fcf43cd181","repo":"rustdesk/rustdesk-server","slug":"timeout-of-test-hbbs","errorCode":null,"errorMessage":"Timeout of test_hbbs","messagePattern":"Timeout of test_hbbs","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/rendezvous_server.rs","lineNumber":1356,"sourceCode":"        } else {\n            IpAddr::V6(Ipv6Addr::LOCALHOST)\n        });\n    }\n\n    let mut socket = FramedSocket::new(config::Config::get_any_listen_addr(addr.is_ipv4())).await?;\n    let mut msg_out = RendezvousMessage::new();\n    msg_out.set_register_peer(RegisterPeer {\n        id: \"(:test_hbbs:)\".to_owned(),\n        ..Default::default()\n    });\n    let mut last_time_recv = Instant::now();\n\n    let mut timer = interval(Duration::from_secs(1));\n    loop {\n        tokio::select! {\n          _ = timer.tick() => {\n              if last_time_recv.elapsed().as_secs() > 12 {\n                  bail!(\"Timeout of test_hbbs\");\n              }\n              socket.send(&msg_out, addr).await?;\n          }\n          Some(Ok((bytes, _))) = socket.next() => {\n              if let Ok(msg_in) = RendezvousMessage::parse_from_bytes(&bytes) {\n                 log::trace!(\"Recv {:?} of test_hbbs\", msg_in);\n                 last_time_recv = Instant::now();\n              }\n          }\n        }\n    }\n}\n\n#[inline]\nasync fn send_rk_res(\n    socket: &mut FramedSocket,\n    addr: SocketAddr,\n    res: register_pk_response::Result,","sourceCodeStart":1338,"sourceCodeEnd":1374,"githubUrl":"https://github.com/rustdesk/rustdesk-server/blob/a7736be5e40f85bfc141120dce587e836e5d4b80/src/rendezvous_server.rs#L1338-L1374","documentation":"This is a self-test watchdog inside hbbs: when the server runs in test mode (test_hbbs, started by start_with_bind), it waits for a parsed RendezvousMessage on its socket; if nothing arrives for more than 12 seconds, it bails with \"Timeout of test_hbbs\", ending the self-test. It exists so a broken server loop fails fast instead of hanging forever.","triggerScenarios":"Running hbbs in test_hbbs mode and the local socket receives no parseable RendezvousMessage within 12 seconds - either the test client never sent a message, the packet was corrupt (parse_from_bytes failed), or the server loop is stuck.","commonSituations":"CI smoke tests of hbbs where the test client is slow to start or sends a malformed message; firewall/loopback issues preventing the test packet from arriving; protocol changes between test client and server breaking parse_from_bytes.","solutions":["Ensure the test client sends a valid, current-protocol RendezvousMessage promptly (well under 12s) after the server starts.","Check loopback networking/firewall rules so the test packet can reach the bound socket.","Enable trace logging (log::trace shows 'Recv ... of test_hbbs') to see whether messages arrive but fail to parse.","If the test legitimately needs longer, increase the 12-second threshold in src/rendezvous_server.rs."],"exampleFix":"// test harness: send the probe message immediately, with retry\nlet mut attempts = 0;\nwhile attempts < 3 {\n    socket.send(&msg, addr).await.ok();\n    if socket.recv_timeout(Duration::from_secs(2)).is_ok() { break; }\n    attempts += 1;\n}","handlingStrategy":"try-catch","validationCode":"// CI: verify the probe message parses with the same protocol version before starting the test\nlet _ = RendezvousMessage::parse_from_bytes(&probe_bytes).expect(\"probe must parse\");","typeGuard":null,"tryCatchPattern":"// wrap the self-test runner with a timeout-tolerant wrapper\nmatch tokio::time::timeout(Duration::from_secs(20), test_hbbs()).await {\n    Err(_) => log::warn!(\"test_hbbs watchdog fired (12s no-reply)\"),\n    Ok(Err(e)) => log::error!(\"test_hbbs failed: {e}\"),\n    Ok(Ok(())) => log::info!(\"test_hbbs passed\"),\n}","preventionTips":["Keep the test client and hbbs on the same protocol version so parse_from_bytes succeeds.","Start the test client before or immediately with the server to stay under the 12s window.","Allow loopback traffic in CI containers/firewalls.","Raise the 12s threshold if CI machines are slow."],"tags":["network","timeout","self-test","rendezvous"],"backgroundTag":"request-timeout","analyzedSha":"a7736be5e40f85bfc141120dce587e836e5d4b80","analyzedAt":"2026-09-09T21:56:29.933Z","contentChangedAt":"2026-09-09T21:56:29.933Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}