bpo-35998: Avoid TimeoutError in test_asyncio: test_start_tls_server_1()#14080
bpo-35998: Avoid TimeoutError in test_asyncio: test_start_tls_server_1()#14080vstinner merged 2 commits intopython:masterfrom
Conversation
vstinner
left a comment
There was a problem hiding this comment.
LGTM, I just have a minor comment.
On Fedora 30, reproducing the take takes me 5 seconds using (the test hangs for a few minutes and then fail):
./python -m test test_asyncio -m test_start_tls_server_1 -F
With this change, the test no longer hangs.
I can ./python -m test test_asyncio -m test_start_tls_server_1 -F 6 times in parallel for 5 minutes, my system load is around 7.0 (the system is very busy), and the test still doesn't hang. So I can confirm that this change fix the issue for me.
|
GH-14084 is a backport of this pull request to the 3.8 branch. |
|
Sorry, @asvetlov and @vstinner, I could not cleanly backport this to |
|
I'll make backport myself |
|
GH-14086 is a backport of this pull request to the 3.7 branch. |
|
@asvetlov: I just made it :-) I really want this bug to go away, it annoy me on buildbots for 6 months at least. It was a stupid conflict on additional "loop=self.loop" in 3.7. |
|
Yes, I see. |
The test was not robust because it used to rely on
sock.shutdown(socket.SHUT_RDWR)beforesock.close().Actually, sometimes these socket state changes are merged into the just transition into the socket-closed state on the peer side. I don't want to add sleep(N) between calls, it is the easiest way to add new test flakiness.
The
start_tlstest doesn't need to checkproto.eof_received()callback receiving, there are other explicit tests for it.The test is changed to receive TSL encrypted data and send an acknowledgment back before client socket closing.
Now everything works smoothly, I don't see any timeout exceptions even under very heavy testing.
https://bugs.python.org/issue35998