pytest-dev / pytest-dev/pytest-django
OSError: [Errno 98] Address already in use on second test session run
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 367
- PR merge metrics
- No merged PRs in 30d
Description
I use the liveserver fixture with a fixed port because I need SSL and have nginx setup in front of it. The first test runs fine, but when running another pytest session before TIME_WAIT expires I get the address already in use error. I suspect either cleanup is not done properly when the liveserver quits or it's just a TCP/IP thing.
Is there a workaround for this? I really need the fixed port because otherwise proxying from nginx won't work.
Thanks!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the fixed-port liveserver failure across two pytest sessions, then inspect the liveserver fixture's shutdown and port cleanup behavior. Done means the second session can run before TIME_WAIT expires, or the issue documents a verified workaround for fixed-port SSL setups.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, nginx, python
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100