XX-net/XX-Net · warning
Except %s send BlockingIOError %r
Error message
Except %s send BlockingIOError %r
What it means
s2.send() raised BlockingIOError on a non-blocking socket: the kernel send buffer is full and no bytes could be written. sent is set to 0 and the buffered-send path (with EAGAIN handling) takes over.
Source
Thrown at code/default/smart_router/local/pipe_socks.py:281
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:
# if str(e) == "[Errno 35] Resource temporarily unavailable":
xlog.warn("%s send errno.EAGAIN %r", s2, e)
time.sleep(0.1)
sent = 0
else:
self.close(s2, "w")
continue
except Exception as e:
# xlog.debug("%s send e:%r", s2, e)
if sys.version_info[0] == 3 and isinstance(e, BlockingIOError):
# This error happened on upload large file or speed test
# Just ignore this error and will be fine
xlog.warn("%s send BlockingIOError %r", s2, e)
sent = 0
else:View on GitHub (pinned to cfa5bc17b6)
Solutions
- Rely on the subsequent EAGAIN/buffered-send path (already present) to queue the data
- Increase SO_SNDBUF or apply backpressure to the reader side
- Use select/epoll writability checks before sending
- Close or deprioritize connections that stay unwritable too long
Defensive patterns
Strategy: retry
Validate before calling
if not writable(s2): wait_for_writable(s2)
Try / catch
Treat BlockingIOError as sent=0 and queue for later flush; only close on repeated EAGAIN past a deadline.
Prevention
- Check socket writability before send on non-blocking sockets
- Cap per-connection unsent buffer to bound memory
When it happens
Trigger: Calling send() on a non-blocking socket whose send buffer is completely full; typical in the pipe relay loop when the remote drains slowly.
Common situations: High-throughput relaying to a slow remote; small SO_SNDBUF; burst traffic; peer application not reading.
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/4637089af152f9f5.
Report an issue: GitHub.