From d73612f917c4263c1ea1c1f265f4b320dfb8191d Mon Sep 17 00:00:00 2001 From: ykvch Date: Mon, 27 Feb 2023 13:09:02 +0200 Subject: [PATCH] Fix unknown worker spawning message --- locust/runners.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/locust/runners.py b/locust/runners.py index 63f3465139..e8f77d5641 100644 --- a/locust/runners.py +++ b/locust/runners.py @@ -1087,7 +1087,11 @@ def client_listener(self) -> NoReturn: elif msg.type == "stats": self.environment.events.worker_report.fire(client_id=msg.node_id, data=msg.data) elif msg.type == "spawning": - self.clients[msg.node_id].state = STATE_SPAWNING + try: + self.clients[msg.node_id].state = STATE_SPAWNING + except KeyError: + logger.warning(f"Got spawning message from unknown worker {msg.node_id}. Asking worker to quit.") + self.server.send_to_client(Message("quit", None, msg.node_id)) elif msg.type == "spawning_complete": self.clients[msg.node_id].state = STATE_RUNNING self.clients[msg.node_id].user_classes_count = msg.data["user_classes_count"]