prometheus / prometheus/client_python

reuse address on server

Open
#155 14 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
4.4k
Forks
876
Avg merge
8d 4h
Merged PRs (30d)
1

Description

start_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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with start_hpp_server and the HTTPServer setup shown in lib64/python3.4/site-packages/prometheus_client/exposition.py at line 103. Reproduce the restart scenario that raises Errno 98, then inspect the surrounding server startup path. Done means a prior instance can stop and the server can restart on the same port without the reported address-in-use failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
observability
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.