Title: [3.8] bpo-37193: remove thread objects which finished process its request (GH-13893) by miss-islington · Pull Request #23088 · python/cpython · GitHub
Open Graph Title: [3.8] bpo-37193: remove thread objects which finished process its request (GH-13893) by miss-islington · Pull Request #23088 · python/cpython
X Title: [3.8] bpo-37193: remove thread objects which finished process its request (GH-13893) by miss-islington · Pull Request #23088 · python/cpython
Description: bpo-37193: remove the thread which finished process request from threads list rename variable t to thread. don't remove thread from list if it is daemon. use lock to protect self._threads. use finally block in case of exception from shutdown_request(). check "not thread.daemon" before lock to avoid holding the lock if it's unnecessary. fix the place of _threads_lock. separate code to remove a current thread into a function. check ValueError when removing thread. fix wrong code which all instance shared same lock. Extract thread management into a _Threads class to encapsulate atomic operations and separate concerns. Replace multiple references of 'block_on_close' with one, avoiding the possibility that 'block_on_close' could change during the course of processing requests. Now, there's exactly one _threads object with behavior fixed for the duration. Add docstrings to private classes. Add test to ensure that a ThreadingTCPServer can be closed without serving any requests. Use _NoThreads as the default value. Fixes AttributeError when server is closed without serving any requests. Add blurb Add test capturing failure. Co-authored-by: Jason R. Coombs jaraco@jaraco.com (cherry picked from commit c415590) Co-authored-by: MARUYAMA Norihiro norihiro.maruyama@gmail.com https://bugs.python.org/issue37193
Open Graph Description: bpo-37193: remove the thread which finished process request from threads list rename variable t to thread. don't remove thread from list if it is daemon. use lock to protect self._threads...
X Description: bpo-37193: remove the thread which finished process request from threads list rename variable t to thread. don't remove thread from list if it is daemon. use lock to protect self._thr...
Opengraph URL: https://github.com/python/cpython/pull/23088
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3e881e7d-4e00-b44a-16b2-a97eb1d7e9ac |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 98F0:1D4F69:1B0D53F:24A578F:6A536C01 |
| html-safe-nonce | 54aa641348a84c131906e6ec5311408fb40c9f19448fb95191583bf4bc488abb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEYwOjFENEY2OToxQjBENTNGOjI0QTU3OEY6NkE1MzZDMDEiLCJ2aXNpdG9yX2lkIjoiMzI2Njc0MjQ0NjI2NTE2Njg1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 2b9f13fdf5c7539ba55105f52322249075399731fc68182686bbe79b366630f7 |
| hovercard-subject-tag | pull_request:513715889 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/23088/files |
| twitter:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/31488909?s=400&v=4 |
| og:image:alt | bpo-37193: remove the thread which finished process request from threads list rename variable t to thread. don't remove thread from list if it is daemon. use lock to protect self._threads... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width