Skip to content

gh-101384: add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL#101419

Merged
serhiy-storchaka merged 6 commits intopython:mainfrom
peterjpxie:fix-issue-101384-v2
Feb 17, 2024
Merged

gh-101384: add socket timeout to ThreadedVSOCKSocketStreamTest and skip it on WSL#101419
serhiy-storchaka merged 6 commits intopython:mainfrom
peterjpxie:fix-issue-101384-v2

Conversation

@peterjpxie
Copy link
Contributor

@peterjpxie peterjpxie commented Jan 30, 2023

1/ Add socket server timeout to ThreadedVSOCKSocketStreamTest so that it does not hang on client connection failure, e.g. on WSL.

After adding the timeout, it was able to fail on this test and continue as follows.

./python -m test -v test.test_socket2
======================================================================
ERROR: testStream (test.test_socket2.ThreadedVSOCKSocketStreamTest.testStream)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/peter/repo/cpython/Lib/test/test_socket2.py", line 376, in _setUp
    self.__setUp()
  File "/home/peter/repo/cpython/Lib/test/test_socket2.py", line 522, in setUp
    self.conn, self.connaddr = self.serv.accept()
                               ^^^^^^^^^^^^^^^^^^
  File "/home/peter/repo/cpython/Lib/socket.py", line 295, in accept
    fd, addr = self._accept()
               ^^^^^^^^^^^^^^
TimeoutError: timed out

======================================================================
ERROR: testStream (test.test_socket2.ThreadedVSOCKSocketStreamTest.testStream)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/peter/repo/cpython/Lib/test/test_socket2.py", line 364, in raise_queued_exception
    raise self.queue.get()
  File "/home/peter/repo/cpython/Lib/test/test_socket2.py", line 388, in clientRun
    self.clientSetUp()
  File "/home/peter/repo/cpython/Lib/test/test_socket2.py", line 535, in clientSetUp
    self.cli.connect((cid, VSOCKPORT))
OSError: [Errno 101] Network is unreachable

----------------------------------------------------------------------
Ran 724 tests in 41.724s

FAILED (errors=2, skipped=65)
test test.test_socket2 failed
test.test_socket2 failed (2 errors) in 41.8 sec

== Tests result: FAILURE ==

1 test failed:
    test.test_socket2

Total duration: 41.9 sec
Tests result: FAILURE

2/ Furthermore, as it does not work on WSL (OSError: [Errno 101] Network is unreachable), skip it on WSL.

This works on VMware workstation for communication between VM guests and host.

3/ With all the changes, this is the summary of tests on different platforms:

  • VMware station guest VM ubuntu: Passed
  • Normal ubuntu server: Skipped
  • WSL ubuntu: Skipped

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants