{"record":{"id":"8e883e97f3c3af23","repo":"locustio/locust","slug":"zmq-interrupted-message","errorCode":null,"errorMessage":"ZMQ interrupted message","messagePattern":"ZMQ interrupted message","errorType":"exception","errorClass":"RPCReceiveError","httpStatus":null,"severity":"error","filePath":"locust/rpc/zmqrpc.py","lineNumber":43,"sourceCode":"    def send(self, msg):\n        try:\n            self.socket.send(msg.serialize(), zmq.NOBLOCK)\n        except zmqerr.ZMQError as e:\n            raise RPCSendError(\"ZMQ sent failure\") from e\n\n    @retry()\n    def send_to_client(self, msg):\n        try:\n            self.socket.send_multipart([msg.node_id.encode(), msg.serialize()])\n        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","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/locustio/locust/blob/f391a716e12c2c712e80b5835e877b7933397453/locust/rpc/zmqrpc.py#L25-L61","documentation":"RPCReceiveError raised when Message.unserialize fails with a msgpack ExtraData error while receiving on a ZMQ socket. It means the received bytes were interrupted or contain trailing data that msgpack could not decode as a single Message. The library raises this instead of letting raw msgpack errors propagate through the runner.","triggerScenarios":"A recv() on a BaseSocket where the incoming payload is a truncated or corrupted msgpack stream — e.g. a partial message delivered after a broken connection, or a peer sending malformed bytes.","commonSituations":"Network interruption mid-message between master and worker; a non-locust process connected to the same ZMQ TCP port and sent garbage; mismatched locust/protocol versions between nodes.","solutions":["Ensure all master/worker nodes run the same locust version (wire protocol compatibility)","Restart the affected runner so the ZMQ connection and stream are re-established","Check for other processes bound to the same port sending invalid data","Investigate network instability (MTU issues, flaky links) between the nodes"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    msg = client.recv()\nexcept RPCReceiveError as e:\n    logger.error(f'corrupted message received: {e}')\n    # reconnect/restart the runner","preventionTips":["Pin identical locust/msgpack versions on all nodes","Keep non-locust processes off the ZMQ ports","Restart runners after any corruption instead of reusing the stream"],"tags":["zmq","msgpack","distributed","corruption"],"backgroundTag":"zmq-message-corruption","analyzedSha":"f391a716e12c2c712e80b5835e877b7933397453","analyzedAt":"2026-08-29T00:36:13.872Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}