XX-net/XX-Net · error
login session server is down, try get new server.
Error message
login session server is down, try get new server.
What it means
login_session received HTTP 521 from the X-Tunnel session API. 521 is Cloudflare's 'Web server is down' status, meaning the origin session server is offline. The code records g.last_api_error, clears g.server_host so a new server will be resolved, and returns False so the caller (start) retries with a different host.
Source
Thrown at code/default/x_tunnel/local/proxy_session.py:423
self.session_id,
g.config.max_payload, g.config.send_delay, g.config.windows_size,
int(g.config.windows_ack), g.config.resend_timeout, g.config.ack_delay)
upload_data_head += struct.pack("<H", len(g.config.login_account)) + utils.to_bytes(g.config.login_account)
upload_data_head += struct.pack("<H", len(g.config.login_password)) + utils.to_bytes(g.config.login_password)
extra_info = self.get_login_extra_info()
upload_data_head += struct.pack("<H", len(extra_info)) + utils.to_bytes(extra_info)
upload_post_data = encrypt_data(upload_data_head)
content, status, response = g.http_client.request(method="POST", host=g.server_host, path="/data",
data=upload_post_data,
timeout=g.config.network_timeout)
time_cost = time.time() - start_time
if status == 521:
g.last_api_error = "session server is down."
xlog.warn("login session server is down, try get new server.")
g.server_host = None
return False
if status != 200:
g.last_api_error = "session server login fail:%r" % status
xlog.warn("login session fail, status:%r", status)
continue
if len(content) < 6:
g.last_api_error = "session server protocol fail, login res len:%d" % len(content)
xlog.error("login data len:%d fail", len(content))
continue
info = decrypt_data(content)
magic, protocol_version, pack_type, res, message_len = struct.unpack("<cBBBH", info[:6])
message = info[6:]
if isinstance(message, memoryview):
message = message.tobytes()View on GitHub (pinned to cfa5bc17b6)
Solutions
- Let the client retry — start() will resolve a new server via g.server_host = None and re-login
- Check X-Tunnel status pages/community for known outages
- If persistent, verify DNS/Cloudflare reachability from the client network; adjust available server list
Defensive patterns
Strategy: retry
Validate before calling
# rely on client rotation: g.server_host = None triggers new server resolution before next login
Try / catch
while not session.start():
time.sleep(backoff); backoff = min(backoff*2, 300) # rotates server each failure Prevention
- Let the client rotate session servers on 521 instead of pinning one host
- Add backoff to avoid hammering a down server
When it happens
Trigger: POST to the login/session API returns 521 — the currently selected session server behind Cloudflare is unreachable.
Common situations: Transient outage of the session server, server blocked/taken down, regional Cloudflare issues; commonly resolves by rotating to another server host.
Related errors
- login session fail, status:%r
- login_session time:%d fail, res:%d msg:%s
- login_session %s json error:%r
- save_cloudflare_domain but cloudflare front not enabled
- x-tunnel request_balance fail when create_conn:%s
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/bab41bbe42f6b724.
Report an issue: GitHub.