HTTP server doesn't closed
See original GitHub issueWhat happened: When opening a client twice (or more) like the following code:
from dask.distributed import Client
with Client() as client:
...
...
with Client() as client:
...
or
from dask.distributed import Client
client = Client()
...
client.close()
...
client = Client()
...
client.close()
I`m getting the following warning massage when the new client opens (after one was created before):
/.../opt/anaconda3/envs/mlflow-env/lib/python3.7/site-packages/distributed/node.py:155: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 41137 instead
http_address["port"], self.http_server.port
What you expected to happen: When a client is closed, it should also close the http_server thus releasing the port.
Minimal Complete Verifiable Example:
from dask.distributed import Client
with Client() as client:
print(client)
with Client() as client:
print(client)
Environment:
- Dask version: 2.25.0
- Python version: 3.7.9
- Operating System: Linux
- Install method (conda, pip, source): conda
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
HTTP server.close() does not shut down, process hangs #41895
This is a race condition caused by calling listen() and then immediately calling close() . Case 1 (correct behaviour): If the host parameter...
Read more >Why "Hello, World!" exits but HTTP server doesn't?
You could terminate the server program by issuing server.close() after a while. It would then finish serving any pending connections and eventually exit....
Read more >Can't close server (nodeJS) - Stack Overflow
The client is utilizing HTTP keep-alive. I think you will find that while the existing client can make new requests (as the connection...
Read more >GIS / SI - HTTP Server Adapter doesn't shut down completely ...
2. Uncheck the adapter and re-enable it as soon as it shows up disabled. Be aware that this is not the proper procedure...
Read more >How to terminate a HTTP server in Node.js?
i.e. when you call server.close() , server stops accepting new connections, but it keeps the existing connections open indefinitely. This can ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Are you relying on garbage collection to close your
LocalCluster
for you? It might be safer to use a context manager for it as well, given how complicated shutting down a cluster is.Thanks, this solves the problem.