Skip to content

bpo-43843: libregrtest uses threading.excepthook #25400

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

Merged
merged 4 commits into from
Apr 16, 2021
Merged

bpo-43843: libregrtest uses threading.excepthook #25400

merged 4 commits into from
Apr 16, 2021

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Apr 14, 2021

test.libregrtest now marks a test as ENV_CHANGED (altered the
execution environment) if a thread raises an exception but does not
catch it. It sets a hook on threading.excepthook. Use
--fail-env-changed option to mark the test as failed.

https://bugs.python.org/issue43843

test.libregrtest now marks a test as ENV_CHANGED (altered the
execution environment) if a thread raises an exception but does not
catch it. It sets a hook on threading.excepthook. Use
--fail-env-changed option to mark the test as failed.
@vstinner
Copy link
Member Author

I expected that many tests will start to fail when run using --fail-env-changed and it would be better for fix them first.

Once CI jobs run on the PR will pass, I will use the buildbot label to test it on buildbots.

libregrtest hook now logs the exception type
@vstinner
Copy link
Member Author

Travis CI:

0:00:13 load avg: 2.42 [ 27/427/1] test_socketserver failed (env changed)
Warning -- Uncaught thread exception

libregrtest regrtest_unraisable_hook() and
regrtest_threading_excepthook() now explicitly flush sys.stdout,
sys.stderr and sys.__stderr__.
@vstinner
Copy link
Member Author

vstinner commented Apr 15, 2021

Azure Pipelines PR: test_logging and test_ssl failed on macOS. The logging issue is https://bugs.python.org/issue43842

2021-04-14T14:42:57.2204700Z 0:03:58 load avg: 6.95 [113/427/1] test_logging failed (env changed) (38.3 sec) -- running: test_nntplib (39.6 sec), test_compileall (35.6 sec)
2021-04-14T14:42:57.2215540Z Exception in thread Thread-25 (serve_forever):
2021-04-14T14:42:57.2231390Z Traceback (most recent call last):
2021-04-14T14:42:57.2333370Z   File "/Users/runner/work/cpython/cpython/Lib/threading.py", line 990, in _bootstrap_inner
2021-04-14T14:42:57.2400340Z     self.run()
2021-04-14T14:42:57.2446870Z   File "/Users/runner/work/cpython/cpython/Lib/threading.py", line 928, in run
2021-04-14T14:42:57.2548480Z     self._target(*self._args, **self._kwargs)
2021-04-14T14:42:57.2617960Z   File "/Users/runner/work/cpython/cpython/Lib/test/test_logging.py", line 863, in serve_forever
2021-04-14T14:42:57.2718400Z     asyncore.loop(poll_interval, map=self._map)
2021-04-14T14:42:57.2818590Z   File "/Users/runner/work/cpython/cpython/Lib/asyncore.py", line 203, in loop
2021-04-14T14:42:57.2920000Z     poll_fun(timeout, map)
2021-04-14T14:42:57.3020900Z   File "/Users/runner/work/cpython/cpython/Lib/asyncore.py", line 144, in poll
2021-04-14T14:42:57.3121080Z     r, w, e = select.select(r, w, e, timeout)
2021-04-14T14:42:57.3222100Z OSError: [Errno 9] Bad file descriptor

The test_ssl failure is unrelated to this PR, I already saw in in other PRs.

=> I created https://bugs.python.org/issue43855 to track it

ERROR: test_msg_callback_deadlock_bpo43577 (test.test_ssl.TestSSLDebug)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/test/test_ssl.py", line 4799, in test_msg_callback_deadlock_bpo43577
    s.connect((HOST, server.port))
  File "/Users/runner/work/cpython/cpython/Lib/ssl.py", line 1342, in connect
    self._real_connect(addr, False)
  File "/Users/runner/work/cpython/cpython/Lib/ssl.py", line 1329, in _real_connect
    super().connect(addr)
ConnectionRefusedError: [Errno 61] Connection refused

Azure Pipelines PR: test_asyncio failed on Windows PR win32, this one is unrelated by this PR and is known:

======================================================================
FAIL: test_sendfile_close_peer_in_the_middle_of_receiving (test.test_asyncio.test_sendfile.ProactorEventLoopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\1\s\lib\test\test_asyncio\test_sendfile.py", line 458, in test_sendfile_close_peer_in_the_middle_of_receiving
    self.run_loop(
AssertionError: ConnectionError not raised

@vstinner vstinner added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 15, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @vstinner for commit 0f26db3 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 15, 2021
@vstinner
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants