![](/img/trans.png)
[英]Heroku Application Error: OSError: [Errno 98] Address already in use
[英]Facing error : OSError: [Errno 98] Address already in use: ('', 8089)
我正在嘗試運行 locust,在第一次成功運行它之后,我對我的 locustfile.py 進行了一些更改。 運行 locust 命令后出現錯誤“OSError: [Errno 98] Address already in use: ('', 8089)”。 已經嘗試殺死PID,但它不起作用。 我正在使用 Linux 18.04 系統。 共享完整的日志跟蹤:
[2020-06-23 14:22:25,687] sonali-Latitude-3490/WARNING/locust.main: System open file limit setting is not high enough for load testing, and the OS wouldnt allow locust to increase it by itself. See https://docs.locust.io/en/stable/installation.html#increasing-maximum-number-of-open-files-limit for more info.
[2020-06-23 14:22:25,687] sonali-Latitude-3490/INFO/locust.main: Starting web interface at http://:8089
[2020-06-23 14:22:25,694] sonali-Latitude-3490/INFO/locust.main: Starting Locust 1.0.3
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 854, in gevent._gevent_cgreenlet.Greenlet.run
File "/home/sonali/.local/lib/python3.6/site-packages/locust/web.py", line 288, in start
self.server.serve_forever()
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/baseserver.py", line 398, in serve_forever
self.start()
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/baseserver.py", line 336, in start
self.init_socket()
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/pywsgi.py", line 1500, in init_socket
StreamServer.init_socket(self)
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/server.py", line 180, in init_socket
self.socket = self.get_listener(self.address, self.backlog, self.family)
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/server.py", line 192, in get_listener
return _tcp_listener(address, backlog=backlog, reuse_addr=cls.reuse_addr, family=family)
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/server.py", line 288, in _tcp_listener
sock.bind(address)
OSError: [Errno 98] Address already in use: ('', 8089)
2020-06-23T08:52:25Z <Greenlet at 0x7fcb12f1f148: <bound method WebUI.start of <locust.web.WebUI object at 0x7fcb12ef2668>>> failed with OSError
[2020-06-23 14:22:25,696] sonali-Latitude-3490/CRITICAL/locust.web: Unhandled exception in greenlet: <Greenlet at 0x7fcb12f1f148: <bound method WebUI.start of <locust.web.WebUI object at 0x7fcb12ef2668>>>
Traceback (most recent call last):
File "src/gevent/greenlet.py", line 854, in gevent._gevent_cgreenlet.Greenlet.run
File "/home/sonali/.local/lib/python3.6/site-packages/locust/web.py", line 288, in start
self.server.serve_forever()
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/baseserver.py", line 398, in serve_forever
self.start()
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/baseserver.py", line 336, in start
self.init_socket()
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/pywsgi.py", line 1500, in init_socket
StreamServer.init_socket(self)
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/server.py", line 180, in init_socket
self.socket = self.get_listener(self.address, self.backlog, self.family)
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/server.py", line 192, in get_listener
return _tcp_listener(address, backlog=backlog, reuse_addr=cls.reuse_addr, family=family)
File "/home/sonali/.local/lib/python3.6/site-packages/gevent/server.py", line 288, in _tcp_listener
sock.bind(address)
OSError: [Errno 98] Address already in use: ('', 8089)
[2020-06-23 14:22:25,696] sonali-Latitude-3490/INFO/locust.main: Running teardowns...
[2020-06-23 14:22:25,696] sonali-Latitude-3490/INFO/locust.main: Shutting down (exit code 2), bye.
[2020-06-23 14:22:25,696] sonali-Latitude-3490/INFO/locust.main: Cleaning up runner...
Name # reqs # fails Avg Min Max | Median req/s failures/s
--------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------
Aggregated 0 0(0.00%) 0 0 0 | 0 0.00 0.00
Percentage of the requests completed within given times
Type Name # reqs 50% 66% 75% 80% 90% 95% 98% 99% 99.9% 99.99% 100%
------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------
如果我記得好...
默認情況下,sockets 不會立即關閉。 kernel 處理了一個“溫和”時期,它與 SO_LINGER 值相關聯。 參見例如http://deepix.github.io/2016/10/21/tcprst.html
這意味着您需要在服務器套接字再次可用之前“稍等片刻”。
https://www.programcreek.com/python/example/67443/socket.SO_LINGER中給出了如何在 python 中處理此問題的示例。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.