Title: test.test_socket.RDSTest.testPeek hangs indefinitely
Type: behavior Stage:
Components: Tests Versions: Python 3.8
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Jáchym Barvínek, kkumer, markmcclain, mgorny, pablogsal, vstinner
Priority: normal Keywords:

Created on 2018-11-14 16:14 by markmcclain, last changed 2020-09-21 08:56 by vstinner.

Messages (7)
msg329914 - (view) Author: (markmcclain) Date: 2018-11-14 16:14
test.test_socket.RDSTest.testPeek() can hang indefinitely. ThreadableTest attempts to ensure ordering of operations, but allows both the client and server to proceed without guaranteeing that the data is sent prior to the blocking attempt to peek at the socket's contents.

Either the test needs to make recvfrom non-blocking with a timeout/retry loop or ensure data is sent prior to allowing the server to proceed.
msg329915 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-11-14 16:17
FYI I removed RDSTest.testCongestion() in bpo-34587.

> test.test_socket.RDSTest.testPeek() can hang indefinitely.

Any advice to explain how to reproduce the issue? Can you try to put a sleep() somewhere to make the race condition more likely?
msg360116 - (view) Author: Kresimir Kumericki (kkumer) Date: 2020-01-16 10:59
Sorry if this necrobumping is inappropriate, but I just experienced the same issue of test.test_socket.RDSTest.testPeek() hanging indefinitely, while trying to recompile Python 3.8.1 on Arch Linux.
msg373645 - (view) Author: Michał Górny (mgorny) * Date: 2020-07-14 15:43
I can reproduce test_socket hanging in 2 out of 3 runs. However, in my case testPeek doesn't seem to be the (only) culprit.  Disabling whole RDSTest helps.
msg374770 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-08-03 23:42
I cannot debug this issue on Fedora 32, since RDS sockets are not supported:

$ ./python -m test test_socket -m test.test_socket.RDSTest.testPeek -v
testPeek (test.test_socket.RDSTest) ... skipped 'RDS sockets required for this test.'
msg377233 - (view) Author: Jáchym Barvínek (Jáchym Barvínek) Date: 2020-09-20 21:51
I am experiencing the same issue when trying to build the ArchLinux python package. Not sure how to reproduce, but I can provide specific details of my system if requested.
msg377245 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-09-21 08:56
I don't know what is RDS. How can I enable it on my Fedora?

10:54:43 vstinner@apu$ ./python -m test test_socket -m RDSTest -v

testPeek (test.test_socket.RDSTest) ... skipped 'RDS sockets required for this test.'
testSelect (test.test_socket.RDSTest) ... skipped 'RDS sockets required for this test.'
testSendAndRecv (test.test_socket.RDSTest) ... skipped 'RDS sockets required for this test.'
testSendAndRecvMsg (test.test_socket.RDSTest) ... skipped 'RDS sockets required for this test.'
testSendAndRecvMulti (test.test_socket.RDSTest) ... skipped 'RDS sockets required for this test.'

$ ./python
Python 3.8.6rc1+ (heads/3.8:e3d0e9bab9, Sep 10 2020, 16:05:50) 
[GCC 10.2.1 20200723 (Red Hat 10.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket; socket.socket(socket.PF_RDS, socket.SOCK_SEQPACKET, 0)
OSError: [Errno 97] Address family not supported by protocol
Date User Action Args
2020-09-21 08:56:27vstinnersetmessages: + msg377245
2020-09-20 21:51:11Jáchym Barvíneksetnosy: + Jáchym Barvínek
messages: + msg377233
2020-08-03 23:42:00vstinnersetmessages: + msg374770
2020-07-14 15:43:32mgornysetnosy: + mgorny
messages: + msg373645
2020-01-16 10:59:11kkumersetnosy: + kkumer

messages: + msg360116
versions: + Python 3.8, - Python 3.4, Python 3.5, Python 3.6, Python 3.7
2018-11-14 16:17:52vstinnersetnosy: + pablogsal
2018-11-14 16:17:45vstinnersetnosy: + vstinner
messages: + msg329915
2018-11-14 16:14:47markmcclaincreate