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

Improve logging when locust master port is busy. #1471

Merged

Conversation

cyberw
Copy link
Collaborator

@cyberw cyberw commented Jul 7, 2020

Avoid issues like https://stackoverflow.com/questions/62769727/facing-error-address-already-in-use-while-running-locust

Instead of printing:

[2020-07-07 12:26:25,897] sonali-Latitude-3490/ERROR/stderr: Traceback (most recent call last):
[2020-07-07 12:26:25,897] sonali-Latitude-3490/ERROR/stderr: File "/home/sonali/.local/bin/locust", line 8, in <module>
[2020-07-07 12:26:25,897] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,897] sonali-Latitude-3490/ERROR/stderr: sys.exit(main())
[2020-07-07 12:26:25,897] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,897] sonali-Latitude-3490/ERROR/stderr: File "/home/sonali/.local/lib/python3.6/site-packages/locust/main.py", line 503, in main
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: runners.locust_runner = MasterLocustRunner(locust_classes, options)
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: File "/home/sonali/.local/lib/python3.6/site-packages/locust/runners.py", line 320, in __init__
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: self.server = rpc.Server(self.master_bind_host, self.master_bind_port)
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: File "/home/sonali/.local/lib/python3.6/site-packages/locust/rpc/zmqrpc.py", line 41, in __init__
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: self.socket.bind("tcp://%s:%i" % (host, port))
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: File "zmq/backend/cython/socket.pyx", line 550, in zmq.backend.cython.socket.Socket.bind
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: File "zmq/backend/cython/checkrc.pxd", line 26, in zmq.backend.cython.checkrc._check_rc
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: zmq.error
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: .
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: ZMQError
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: :
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: Address already in use
[2020-07-07 12:26:25,898] sonali-Latitude-3490/ERROR/stderr: 

It will print something like:

[2020-07-07 10:19:28,906] lafp-mac-JG5J.int.svenskaspel.se/ERROR/locust.runners: The Locust master port (5557) was busy. Close any applications using that port - perhaps an old instance of Locust is still running? (Socket bind failure: Address already in use)

@codecov
Copy link

codecov bot commented Jul 7, 2020

Codecov Report

Merging #1471 into master will increase coverage by 0.35%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1471      +/-   ##
==========================================
+ Coverage   81.11%   81.47%   +0.35%     
==========================================
  Files          27       27              
  Lines        2378     2386       +8     
  Branches      365      366       +1     
==========================================
+ Hits         1929     1944      +15     
+ Misses        357      351       -6     
+ Partials       92       91       -1     
Impacted Files Coverage Δ
locust/runners.py 80.61% <77.77%> (+0.32%) ⬆️
locust/stats.py 89.01% <0.00%> (+0.22%) ⬆️
locust/user/task.py 96.21% <0.00%> (+0.54%) ⬆️
locust/clients.py 95.09% <0.00%> (+4.90%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a141a5a...8968ee6. Read the comment docs.

@cyberw cyberw merged commit 1d14cad into master Jul 7, 2020
@cyberw cyberw deleted the more-user-friendly-logging-when-locust-master-port-is-busy branch August 19, 2020 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant