Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Sporadic test failures in BPD tests #3309
Travis seems to fail surprisingly often in the BPD tests with this error:
Here's an example job, 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 99778d9 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.
It seems really weird that there would still be collisions with the port randomised like that. It's not like any of the tests lasts for very long either, and the server should be killed reliably in the
I have not yet looked at this thoroughly, so do not believe anything I say!
According to this StackOverflow question we can just use port
To get that port number from the server process to the main process in order to create the clients, we could use a multiprocessing.Value. Though to write to that
The bpd test bind a socket in order to test the protocol implementation. When running concurrently this often resulted in an attempt to bind an already occupied port. By using the port number `0` we instead let the OS choose a free port. We then have to extract it from the socket (which is handled by `bluelet`) via `mock.patch`ing.