Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

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.

@ghost
Copy link

ghost commented Jan 30, 2023

The following commit authors need to sign the Contributor License Agreement:

  • peter@Xiaomi-ShaWuJing

Click the button to sign:
CLA not signed

@peterjpxie peterjpxie closed this Jan 30, 2023
@peterjpxie
Copy link
Contributor Author

Forgot to set user.email and user.name and it ends up with a invalid author peter@Xiaomi-ShaWuJing that I can't sign the CLA, close it and will re-do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants