Title: test_ssl: ConnectionHandler shuts down ThreadedEchoServer · Issue #126500 · python/cpython · GitHub
Open Graph Title: test_ssl: ConnectionHandler shuts down ThreadedEchoServer · Issue #126500 · python/cpython
X Title: test_ssl: ConnectionHandler shuts down ThreadedEchoServer · Issue #126500 · python/cpython
Description: Recently, test_ssl has been failing intermittently but frequently on macOS buildbots, see for example here (but look at the first failure; the re-run is #126499). If read() in a ThreadedEchoServer's ConnectionHandler thread raises OSErro...
Open Graph Description: Recently, test_ssl has been failing intermittently but frequently on macOS buildbots, see for example here (but look at the first failure; the re-run is #126499). If read() in a ThreadedEchoServer'...
X Description: Recently, test_ssl has been failing intermittently but frequently on macOS buildbots, see for example here (but look at the first failure; the re-run is #126499). If read() in a ThreadedEchoServer&...
Opengraph URL: https://github.com/python/cpython/issues/126500
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"test_ssl: ConnectionHandler shuts down ThreadedEchoServer","articleBody":"\r\nRecently, `test_ssl` has been failing intermittently but frequently on macOS buildbots, see for example [here](https://buildbot.python.org/#/builders/725/builds/8906) (but look at the *first* failure; the re-run is #126499).\r\n\r\n\r\nIf `read()` in a `ThreadedEchoServer`'s `ConnectionHandler` thread raises `OSError` (except `ConnectionError`), the `ConnectionHandler` shuts down the entire server, preventing further connections.\r\n\r\nAs far as I can see, this is done to avoid the server thread getting stuck, forgotten, in its accept loop. However, since 2011 (5b95eb90a7167285b6544b50865227c584943c9a) the server is used as a context manager, and its `__exit__` does `stop()` and `join()`.\r\n(I'm not sure if we *always* used `with` since that commit, but currently we do.)\r\n\r\nThe most common failure I saw is the following. Note that it's the *third* `connect` call in this test: presumably, if the server thread started shutting down after the first `connect` it had enough time by now. But sometimes the same happens with the second `connect`, in this test or another one.\r\n```\r\nTraceback (most recent call last):\r\n File \"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/test/test_ssl.py\", line 1897, in test_connect_with_context\r\n s.connect(self.server_addr)\r\n ~~~~~~~~~^^^^^^^^^^^^^^^^^^\r\n File \"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/ssl.py\", line 1405, in connect\r\n self._real_connect(addr, False)\r\n ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^\r\n File \"/Users/buildbot/buildarea/3.x.pablogsal-macos-m1.macos-with-brew/build/Lib/ssl.py\", line 1392, in _real_connect\r\n super().connect(addr)\r\n ~~~~~~~~~~~~~~~^^^^^^\r\nConnectionRefusedError: [Errno 61] Connection refused\r\n```\r\n\r\nI'll send a PR soon.\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-126503\n* gh-126571\n* gh-126572\n* gh-133148\n* gh-134030\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/encukou","@type":"Person","name":"encukou"},"datePublished":"2024-11-06T14:13:29.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/126500/cpython/issues/126500"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:471d702f-bb6e-458a-5987-b9affda90b01 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D7E8:2ECE06:245CD4D:3486CC9:6A57AEDA |
| html-safe-nonce | bc688970ef94677b926f76e9d0d9a29fe7bb625ead350e038da594b59b2bbe76 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEN0U4OjJFQ0UwNjoyNDVDRDREOjM0ODZDQzk6NkE1N0FFREEiLCJ2aXNpdG9yX2lkIjoiMjc4MTY0MDMzNDE1NzI2MjU1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8e5633bf98b1ab2bda29e07304bd2909aa48a9c3e71e9257789797cb1ac0800a |
| hovercard-subject-tag | issue:2638211961 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/126500/issue_layout |
| twitter:image | https://opengraph.githubassets.com/027fe9ab4bca385e026bf77b98bbdc60ee845e12dc08ce1a65075eef345f9fc2/python/cpython/issues/126500 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/027fe9ab4bca385e026bf77b98bbdc60ee845e12dc08ce1a65075eef345f9fc2/python/cpython/issues/126500 |
| og:image:alt | Recently, test_ssl has been failing intermittently but frequently on macOS buildbots, see for example here (but look at the first failure; the re-run is #126499). If read() in a ThreadedEchoServer'... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | encukou |
| hostname | github.com |
| expected-hostname | github.com |
| None | 017a07c29bdd8a37b5907fc9a689338deb7103b5af7f56714193b2700229b3df |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4cd16a676f89d1cedb932671a5c2d20b8e60f86a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width