{"record":{"id":"36a8da8f542018f0","repo":"XX-net/XX-Net","slug":"roundtrip-failed-no-d-target-d-on-road-d-timeo","errorCode":null,"errorMessage":"roundtrip failed, no:%d target:%d on_road:%d timeout:%d send:%d","messagePattern":"roundtrip failed, no:(.+?) target:(.+?) on_road:(.+?) timeout:(.+?) send:(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"code/default/x_tunnel/local/proxy_session.py","lineNumber":1098,"sourceCode":"                        del self.transfer_list[transfer_no]\n\n                self.round_trip_process(data, ack, rcvd_no_list, sent_no_list, unack_snd_sn, server_time)\n                self.check_upload_not_acked(server_time)\n\n                if self.on_road_num + 1 < self.target_on_roads:\n                    self.wait_queue.notify()\n\n                self.wait_queue.notify()\n                return\n            except Exception as e:\n                xlog.exception(\"trip:%d no:%d data not enough %r\", work_id, transfer_no, e)\n\n                data_info[\"stat\"] = \"timeout\"\n                continue\n\n                # xlog.debug(\"trip:%d no:%d recv data:%s\", work_id, transfer_no, parse_data(data))\n\n        xlog.warn(\"roundtrip failed, no:%d target:%d on_road:%d timeout:%d send:%d\",\n                   transfer_no, self.target_on_roads, self.on_road_num, server_timeout,\n                   len(upload_post_data))\n        self.wait_queue.notify()\n\n\ndef parse_data(data):\n    if len(data) == 0:\n        return \"\"\n\n    o = \"\"\n\n    data = bytes(data)\n    data = base_container.ReadBuffer(data)\n    while len(data):\n\n        sn, block_len = struct.unpack(\"<II\", data.get(8))\n        block = data.get_buf(block_len)\n","sourceCodeStart":1080,"sourceCodeEnd":1116,"githubUrl":"https://github.com/XX-net/XX-Net/blob/cfa5bc17b67676e467f37ec50766127e0ab5f0aa/code/default/x_tunnel/local/proxy_session.py#L1080-L1116","documentation":"Emitted when a roundtrip_task exhausts its retry/timeout loop without receiving the expected transfer (transfer_no) from the server. It reports the transfer number, target vs actual on-road requests, the server timeout and the size of the upload data, then notifies the wait queue so waiting workers can proceed. Functionally it means the upload/download multiplexed transfer failed for this round.","triggerScenarios":"The inner loop of roundtrip_task never matches the expected transfer_no before hitting its overall failure path — e.g. every attempt timed out (data_info['stat'] == 'timeout') or returned data for a different transfer. Caused by server-side drops, severe packet loss, or the session being reset mid-flight.","commonSituations":"Unstable connectivity to the x_tunnel server, server restart invalidating transfer numbers, quota/session expiry mid-transfer, or MTU/firewall middleboxes silently dropping the large upload_post_data.","solutions":["Verify connectivity and re-login: call/trigger request_balance and confirm quota > 0 and session is alive.","Check server availability and switch g.server_host to another relay.","Retry the roundtrip (the waiters are notified; a new roundtrip_task will be spawned) and watch for repeated failures.","Capture the upload size from the log; if large transfers always fail, inspect MTU/fragmentation or reduce upload chunk size."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# before starting bulk transfers, ensure session health\nif not g.server_host or g.quota <= 0:\n    # re-login instead of letting roundtrips fail\n    ok, reason = request_balance(g.config.login_account, g.config.login_password)\n    if not ok:\n        raise RuntimeError('session not ready: %s' % reason)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep request_balance fresh so transfers never run on a dead session.","Watch on_road_num vs target_on_roads divergence as an early failure signal.","Retry failed roundtrips with backoff; notify waiters as the code already does."],"tags":["x-tunnel","roundtrip","timeout","transfer-failed","network"],"backgroundTag":"request-timeout","analyzedSha":"cfa5bc17b67676e467f37ec50766127e0ab5f0aa","analyzedAt":"2026-08-27T19:28:28.225Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}