sqlmapproject/sqlmap · error · InterfaceError
connection closed by server
Error message
connection closed by server
What it means
recv() returned an empty byte string inside recvn's exact-length loop: the peer closed the socket cleanly before the full n-byte frame arrived. On a framed wire protocol this is stream desynchronization or a server-side abort, not a short message.
Solutions
- Propagate as InterfaceError so callers drop the connection instead of parsing a partial frame
- Log how many of the n bytes were received to diagnose truncation vs early close
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at extra/dbwire/__init__.py:124 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Connection failures: ECONNREFUSED, ECONNRESET, and friends — why connections get refused, reset, or dropped.
AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26).
Data as JSON: /api/errors/be42fc25d73ad384.
Report an issue: GitHub.
Appendix: source
Thrown at extra/dbwire/__init__.py:124
except Exception:
pass
def recvn(sock, n):
"""
Read exactly n bytes off `sock`, or raise - every wire protocol here is framed, so a short read is a
desynchronized stream, not a smaller message.
Shared because it was five identical copies: a fix to the recv loop has to land once, not per module.
"""
buf = b""
while len(buf) < n:
try:
chunk = sock.recv(n - len(buf))
except (socket.error, OSError) as ex:
raise connection_lost(ex)
if not chunk:
raise InterfaceError("connection closed by server")
buf += chunk
return buf
View on GitHub (pinned to 0a35b20e39)