Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dont reset connection to worker if master receives a corrupted zmq message #2266

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,14 +988,9 @@ def client_listener(self) -> NoReturn:
try:
client_id, msg = self.server.recv_from_client()
except RPCReceiveError as e:
logger.error(f"RPCError when receiving from client: {e}. Will reset client {client_id}.")
try:
self.server.send_to_client(Message("reconnect", None, client_id))
except Exception as e:
logger.error(f"Error sending reconnect message to worker: {e}. Will reset RPC server.")
self.connection_broken = True
gevent.sleep(FALLBACK_INTERVAL)
continue
# TODO: Add proper reconnect if https://github.com/zeromq/pyzmq/issues/1809 fixed
logger.error(f"Unrecognized message detected: {e}")
continue
except RPCSendError as e:
logger.error(f"Error sending reconnect message to worker: {e}. Will reset RPC server.")
self.connection_broken = True
Expand Down
7 changes: 1 addition & 6 deletions locust/test/test_runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -3040,12 +3040,7 @@ def my_task(self):
master.start(10, 10)
sleep(0.1)
server.mocked_send(Message("stats", BAD_MESSAGE, "zeh_fake_client1"))
self.assertEqual(4, len(server.outbox))

# Expected message order in outbox: ack, spawn, reconnect, ack
self.assertEqual(
"reconnect", server.outbox[2][1].type, "Master didn't send worker reconnect message when expected."
)
self.assertEqual(2, len(server.outbox))


class TestWorkerRunner(LocustTestCase):
Expand Down