XX-net/XX-Net · warning

send split SNI:%s fail:%r

Error message

send split SNI:%s fail:%r

What it means

A generic exception (not BlockingIOError) escaped flush_send_s() while sending the first half of a split-SNI request to s2. The write side is closed and the connection abandoned.

Source

Thrown at code/default/smart_router/local/pipe_socks.py:266

                        if p1 > 1:
                            if b"google" in s2.host:
                                p2 = d.find(b"google") + 3
                            else:
                                p2 = p1 + len(s2.host) - 6

                            d1 = d[:p2]
                            d2 = d[p2:]

                            try:
                                flush_send_s(s2, d1)
                                s2.sent_data += len(d1)
                                s2.sent_times += 1
                            except BlockingIOError as e:
                                xlog.warn("Except %s flush_send_s BlockingIOError %r", s2, e)
                                self.close(s2, "w")
                                continue
                            except Exception as e:
                                xlog.warn("send split SNI:%s fail:%r", s2.host, e)
                                self.close(s2, "w")
                                continue

                            s2.add_dat(d2)
                            d = b""
                            xlog.debug("pipe send split SNI:%s", s2.host)

                    if s2.buf_size == 0:
                        try:
                            sent = s2.send(d)
                            s2.sent_data += sent
                            s2.sent_times += 1
                            # xlog.debug("direct send %d to %s from:%s total:%d", sent, s2, s1, len(d))
                        except BlockingIOError as e:
                            xlog.warn("Except %s send BlockingIOError %r", s2, e)
                            sent = 0
                        except socket.error as e:
                            if e.errno == errno.EAGAIN:

View on GitHub (pinned to cfa5bc17b6)

Solutions

  1. Inspect the logged %r exception to identify the real cause (reset/broken pipe/SSL)
  2. Verify remote endpoint reachability and that the peer accepts the split-SNI connection
  3. Handle the exception without closing only the write side if full teardown is intended
  4. Add retry with a different route/endpoint
Defensive patterns

Strategy: try-catch

Try / catch

except Exception as e: log repr(e); classify reset/broken-pipe vs programming error before closing.

Prevention

When it happens

Trigger: Any non-EAGAIN socket error during flush_send_s: connection reset by peer, broken pipe, SSL error on a wrapped socket, or bad buffer state after SNI splitting.

Common situations: Remote proxy resets the connection mid-write; TLS handshake failure on wrapped socket; upstream closed during large buffered flush.

Related errors


AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27). Data as JSON: /api/errors/9cfbe4a1234354e4. Report an issue: GitHub.