SeattleTestbed / repy_v1

Seattle Testbed's original Repy version 1 sandbox
MIT License
1 stars 4 forks source link

Some unit tests fail, even after waiting #137

Open aaaaalbert opened 8 years ago

aaaaalbert commented 8 years ago

Note: This is an old issue, ported over from SeattleTestbed/utf#49.

Original report

The following unit tests fail even after waiting. Tested when building a new installer for Mac.

ut_repytests_testconcurrentopenconns.py
ut_repytests_testnetbothdup.py
ut_repytests_testnetconndup.py
ut_repytests_testnetmessdup.py
ut_repytests_testrecvmessfunctions.py
ut_repytests_testwaitforconnfunctions.py

Reply

I fired up Wireshark on my MacBook Pro to see what packets are actually sent by testconcurrentopenconns (for a start). The connection is opened OK and closed soon afterwards, i.e. sock1 works and sock2 probably raises the expected Exception. The packet trace shows however that the Yahoo server used in the test complains about an invalid HTTP request sent (in this case, there was none). My computer thinks it already closed the connection, and signals the server so. There is no waiting for timeouts between attempts. The actual problem in this unit test arises when the final TCP SYN (opening request) from my machine is declined by the server, resulting in Unexpected exception! '[Errno 61] Connection refused' of type ''. We should block execution! If I change the server contacted to something different, google.com for instance, it works. There is a 30-second pause between attempts, and the server doesn't refuse the final connection. It also works if I use yahoo.com and sleep(30) between attempts. Maybe the "invalid HTTP request" response sent after the first connection attempt confuses the Mac's network stack (or our abstractions).