{"record":{"id":"e02577aa9c6b59af","repo":"locustio/locust","slug":"zmq-interrupted-or-corrupted-message","errorCode":null,"errorMessage":"ZMQ interrupted or corrupted message","messagePattern":"ZMQ interrupted or corrupted message","errorType":"exception","errorClass":"RPCReceiveError","httpStatus":null,"severity":"error","filePath":"locust/rpc/zmqrpc.py","lineNumber":53,"sourceCode":"        except zmqerr.ZMQError as e:\n            raise RPCSendError(\"ZMQ sent failure\") from e\n\n    def recv(self):\n        try:\n            data = self.socket.recv()\n            msg = Message.unserialize(data)\n        except msgerr.ExtraData as e:\n            raise RPCReceiveError(\"ZMQ interrupted message\") from e\n        except zmqerr.ZMQError as e:\n            raise RPCError(\"ZMQ network broken\") from e\n        return msg\n\n    def recv_from_client(self):\n        try:\n            data = self.socket.recv_multipart()\n            addr = data[0].decode()\n        except UnicodeDecodeError as e:\n            raise RPCReceiveError(\"ZMQ interrupted or corrupted message\") from e\n        except zmqerr.ZMQError as e:\n            raise RPCError(\"ZMQ network broken\") from e\n        try:\n            msg = Message.unserialize(data[1])\n        except (UnicodeDecodeError, msgerr.ExtraData) as e:\n            raise RPCReceiveError(\"ZMQ interrupted or corrupted message\", addr=addr) from e\n        return addr, msg\n\n    def close(self, linger=None):\n        self.socket.close(linger=linger)\n\n    def ipv4_only(self, host, port) -> bool:\n        try:\n            if host == \"*\":\n                return False\n            if str(csocket.getaddrinfo(host, port, proto=csocket.IPPROTO_TCP)).find(\"Family.AF_INET6\") == -1:\n                return True\n        except gaierror as e:","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/locustio/locust/blob/f391a716e12c2c712e80b5835e877b7933397453/locust/rpc/zmqrpc.py#L35-L71","documentation":"RPCReceiveError raised in recv_from_client when the address frame (the first part of the multipart message on the master's ROUTER socket) cannot be decoded as UTF-8. This indicates the multipart frame was corrupted or is not from a locust node, so the message cannot be attributed to a client.","triggerScenarios":"Master calling recv_from_client() and hitting UnicodeDecodeError on data[0] — a garbled first frame from a corrupted stream or a non-locust client connecting to the ROUTER port.","commonSituations":"Something other than a locust worker connected to the master's ZMQ TCP port; truncated/corrupted TCP stream; binary garbage sent to the port by a scanner or misconfigured client.","solutions":["Verify only locust workers connect to the master port; firewall it from other traffic","Ensure master and worker locust versions match","Restart the master to reset the corrupted ZMQ stream","Check network path for corruption (middleboxes, MTU problems)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    addr, msg = server.recv_from_client()\nexcept RPCReceiveError:\n    logger.error('received corrupt frame from unknown client; dropping')\n    continue","preventionTips":["Firewall the master ZMQ port so only locust workers connect","Keep node versions in sync","Restart the master if its stream becomes corrupted"],"tags":["zmq","distributed","corruption","utf-8"],"backgroundTag":"zmq-message-corruption","analyzedSha":"f391a716e12c2c712e80b5835e877b7933397453","analyzedAt":"2026-08-29T00:36:13.872Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}