beetbox / beetbox/beets

Sporadic test failures in BPD tests

Open
#3,309 3 comments 0 reactions 0 assignees View on GitHub
bpd testing
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

Travis seems to fail surprisingly often in the BPD tests with this error:

```
[...]
File "/home/travis/build/beetbox/beets/beets/util/bluelet.py", line 404, in __init__
self.sock.bind((host, port))
OSError: [Errno 98] Address already in use
```

Here's an [example job](https://travis-ci.org/beetbox/beets/jobs/543462082#L1121), for instance.

The problem is that these tests, since #3190, use a socket to set up communication between a server and a client. But if two of these run at the same time, then the server runs into an error when trying to listen on that socket. I tried to mitigate this in a hacky way in https://github.com/beetbox/beets/commit/99778d9ece151736ea2447a70e3fe7efd146b6c8 by randomizing the port over 10,000 options, but failures of this kind are still happening pretty often on Travis.

A potential solution would be to catch this error and re-randomize a few times before giving up.

Contributor guide

Open the contributing guide

Research direction

Start with the BPD tests and beets/util/bluelet.py around line 404, where the server binds its socket. Reproduce the tests under parallel execution and verify that address-in-use failures are handled with repeated port selection before giving up.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
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.