reuse address on server
See original GitHub issuestart_hpp_server should reuse the port if it is already being used, most likely due to an earlier instance going down and we are restarting
File "lib64/python3.4/site-packages/prometheus_client/exposition.py", line 103, in run
httpd = HTTPServer((addr, port), MetricsHandler)
File "/usr/lib64/python3.4/socketserver.py", line 430, in __init__
self.server_bind()
File "/usr/lib64/python3.4/http/server.py", line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/lib64/python3.4/socketserver.py", line 444, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Reusing socket addresses | Python Network Programming ...
Reusing socket addresses. You want to run a socket server always on a specific port even after it is closed intentionally or unexpectedly....
Read more >Reusing address in socket - how does it actually work
My understanding is that "socket" can be option to let "bind " to reuse port or address. It does not. But "bind" will...
Read more >Java server socket doesn't reuse address - Stack Overflow
I set the reuse address option of the server socket before the binding but it still throws a BindException.
Read more >What exactly does SO_REUSEADDR do? - UnixGuide.net
It is useful if your server has been shut down, and then restarted right away while sockets ... SO_REUSEADDR just says that you...
Read more >Using SO_REUSEADDR and SO_EXCLUSIVEADDRUSE
An additional feature called enhanced socket security is available on Windows Server 2003 and later. The availability of these socket options ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top 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
I’ve been living with my supervisord workaround described in my last post. I had made my proposed change in my own build, which appeared also to work, however I never took the time to submit it, as my workaround was meeting my needs. I need to consider doing that. -tim
A simple fix for this issue might be to have
httpd
as a global that can be accessed - we are doing something similar. That way the caller can callhttpd.shutdown()
in a signal handler. Something like:client program: