Skip to content

Commit

Permalink
Merge pull request #1972 from locustio/ensure-hearbeat_worker-doesnt-…
Browse files Browse the repository at this point in the history
…continue-monitoring-workers-after-quit

Ensure heartbeat_worker doesnt try to re-establish connection to workers when quit has been called
  • Loading branch information
cyberw committed Jan 14, 2022
2 parents a3d1de8 + 6d20383 commit 402bddd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion locust/runners.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,8 @@ def quit(self):
self.server.send_to_client(Message("quit", None, client.id))
gevent.sleep(0.5) # wait for final stats report from all workers
self.server.close()
# ensure heartbeat_worker doesnt try to re-establish connection to workers and throw lots of exceptions
self.clients._worker_nodes = {}
self.greenlet.kill(block=True)

def check_stopped(self):
Expand Down Expand Up @@ -867,7 +869,13 @@ def client_listener(self):
try:
client_id, msg = self.server.recv_from_client()
except RPCError as e:
logger.error("RPCError found when receiving from client: %s" % (e))
if self.clients.ready:
logger.error("RPCError found when receiving from client: %s" % (e))
else:
logger.debug(
"RPCError found when receiving from client: %s (but no clients were expected to be connected anyway)"
% (e)
)
self.connection_broken = True
gevent.sleep(FALLBACK_INTERVAL)
continue
Expand Down

0 comments on commit 402bddd

Please sign in to comment.