XX-net/XX-Net · warning
SendBuffer put 0
Error message
SendBuffer put 0
What it means
SendBuffer.put() was called with an empty bytes object. It refuses to add zero-length data (returns False) because an empty buffer block would corrupt the send-stream accounting.
Source
Thrown at code/default/x_tunnel/local/base_container.py:230
self.mutex = threading.Lock()
self.max_payload = max_payload
self.reset()
def reset(self):
xlog.debug("SendBuffer reset")
self.pool_size = 0
self.last_put_time = time.time()
with self.mutex:
self.head_sn = 1
self.tail_sn = 1
self.block_list = {}
self.last_block = WriteBuffer()
def put(self, data):
dlen = len(data)
# xlog.debug("SendBuffer len:%d", dlen)
if dlen == 0:
xlog.warn("SendBuffer put 0")
return False
# xlog.debug("SendBuffer put len:%d", len(data))
self.last_put_time = time.time()
with self.mutex:
self.pool_size += dlen
self.last_block.append(data)
if len(self.last_block) > self.max_payload:
self.block_list[self.head_sn] = self.last_block
self.last_block = WriteBuffer()
self.head_sn += 1
return True
def get(self):
with self.mutex:
if self.tail_sn < self.head_sn:
data = self.block_list[self.tail_sn]View on GitHub (pinned to cfa5bc17b6)
Solutions
- Find the caller passing empty data and skip sending when the read/payload is empty
- Guard upstream: if not data: return before calling put
- Add an assert/log at the caller to identify which path produces empty buffers
- Treat empty payload as EOF signal if that is the semantic
Example fix
# before
buf.put(data)
# after
if data:
buf.put(data) Defensive patterns
Strategy: validation
Validate before calling
if not data: return False # before calling put
Type guard
def has_payload(d): return len(d) > 0
Prevention
- Never forward empty reads; treat them as EOF
- Check payload length at the producer side
When it happens
Trigger: Caller passes b'' to SendBuffer.put, typically when an upstream read returned 0 bytes but was still forwarded, or a caller didn't check for empty payloads.
Common situations: EOF handling that forwards the empty read result; encoder returning empty output for empty input; edge-case in chunked assembly producing empty frames.
Related errors
AI-assisted analysis of XX-net/XX-Net@cfa5bc17b6 (2026-08-27).
Data as JSON: /api/errors/cb068f27f3f18216.
Report an issue: GitHub.