René's URL Explorer Experiment


Title: Graceful loop shutdown with running executor tasks · Issue #258 · python/asyncio · GitHub

Open Graph Title: Graceful loop shutdown with running executor tasks · Issue #258 · python/asyncio

X Title: Graceful loop shutdown with running executor tasks · Issue #258 · python/asyncio

Description: When I send a long task to tread-pool executor and immediately close the loop without waiting future returned by .run_in_executor() call I get exception report in logs: ERROR:concurrent.futures:exception calling callback for

Open Graph Description: When I send a long task to tread-pool executor and immediately close the loop without waiting future returned by .run_in_executor() call I get exception report in logs: ERROR:concurrent.futures:exc...

X Description: When I send a long task to tread-pool executor and immediately close the loop without waiting future returned by .run_in_executor() call I get exception report in logs: ERROR:concurrent.futures:exc...

Opengraph URL: https://github.com/python/asyncio/issues/258

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Graceful loop shutdown with running executor tasks","articleBody":"When I send a long task to tread-pool executor and immediately close the loop without waiting future returned by `.run_in_executor()` call I get exception report in logs:\n\n```\nERROR:concurrent.futures:exception calling callback for \u003cFuture at 0x7ff1ae393630 state=finished returned NoneType\u003e\nTraceback (most recent call last):\n  File \"/usr/lib/python3.4/concurrent/futures/_base.py\", line 297, in _invoke_callbacks\n    callback(self)\n  File \"/home/andrew/projects/asyncio/asyncio/futures.py\", line 410, in \u003clambda\u003e\n    new_future._copy_state, future))\n  File \"/home/andrew/projects/asyncio/asyncio/base_events.py\", line 487, in call_soon_threadsafe\n    handle = self._call_soon(callback, args)\n  File \"/home/andrew/projects/asyncio/asyncio/base_events.py\", line 461, in _call_soon\n    self._check_closed()\n  File \"/home/andrew/projects/asyncio/asyncio/base_events.py\", line 288, in _check_closed\n    raise RuntimeError('Event loop is closed')\nRuntimeError: Event loop is closed\n```\n\nThat's because task executed in thread has finished after loop closing. The task calls `call_soon_threadsafe()` (see `futures.wrap_future()` for details) and it fails on check for loop health.\n\nDue threaded nature it's hard to avoid situations like this: threads cannot be cancelled, we need cope with these even after loop closing. That's pretty common situation, especially for client-side jobs like web page fetching: DNS resolver is executed in thread pool also.\n\nI see two options:\n1.  Ignore loop closing in `wrap_future` call, skip `call_soon_threadsafe()` for closed loops\n2. Do the same but only if special boolean flag passed into `run_in_executor()` (while I don't see situations when I don't like the behavior, maybe flag should be `True` by default).\n","author":{"url":"https://github.com/asvetlov","@type":"Person","name":"asvetlov"},"datePublished":"2015-07-26T07:45:38.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":12},"url":"https://github.com/258/asyncio/issues/258"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:84a8265e-d797-fe1f-8186-f5c91c503c4d
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA7E4:3DFBD6:15A8C42:1E63E3D:696FD0A6
html-safe-nonce6a1aafe74464f84a95adf276ee789429ddf03d58ff91fe1a179079044349b5cd
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0U0OjNERkJENjoxNUE4QzQyOjFFNjNFM0Q6Njk2RkQwQTYiLCJ2aXNpdG9yX2lkIjoiNjk0NzE2Nzk4ODgzNDM1NzQxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac714d01626170abe3fb30cc50e1b27537bb98a0a0c115efd7182102211f5bff6d
hovercard-subject-tagissue:97295261
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/asyncio/258/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9e1dc1dbc7c83a9c0c239d8f4454ce16c9c0beb867d92fc8508cce4e7c61fbd9/python/asyncio/issues/258
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9e1dc1dbc7c83a9c0c239d8f4454ce16c9c0beb867d92fc8508cce4e7c61fbd9/python/asyncio/issues/258
og:image:altWhen I send a long task to tread-pool executor and immediately close the loop without waiting future returned by .run_in_executor() call I get exception report in logs: ERROR:concurrent.futures:exc...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameasvetlov
hostnamegithub.com
expected-hostnamegithub.com
None0a44b41159f8508d767a50a41d4355b6e6607de801262664cbe75414886e44e9
turbo-cache-controlno-preview
go-importgithub.com/python/asyncio git https://github.com/python/asyncio.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id33739295
octolytics-dimension-repository_nwopython/asyncio
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id33739295
octolytics-dimension-repository_network_root_nwopython/asyncio
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release347f3ebfaef84b36b267c7a20bade84594f267d5
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/python/asyncio/issues/258#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fasyncio%2Fissues%2F258
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fasyncio%2Fissues%2F258
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fasyncio
Reloadhttps://patch-diff.githubusercontent.com/python/asyncio/issues/258
Reloadhttps://patch-diff.githubusercontent.com/python/asyncio/issues/258
Reloadhttps://patch-diff.githubusercontent.com/python/asyncio/issues/258
python https://patch-diff.githubusercontent.com/python
asynciohttps://patch-diff.githubusercontent.com/python/asyncio
Please reload this pagehttps://patch-diff.githubusercontent.com/python/asyncio/issues/258
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fpython%2Fasyncio
Fork 185 https://patch-diff.githubusercontent.com/login?return_to=%2Fpython%2Fasyncio
Star 1.1k https://patch-diff.githubusercontent.com/login?return_to=%2Fpython%2Fasyncio
Code https://patch-diff.githubusercontent.com/python/asyncio
Issues 76 https://patch-diff.githubusercontent.com/python/asyncio/issues
Pull requests 10 https://patch-diff.githubusercontent.com/python/asyncio/pulls
Actions https://patch-diff.githubusercontent.com/python/asyncio/actions
Projects 0 https://patch-diff.githubusercontent.com/python/asyncio/projects
Wiki https://patch-diff.githubusercontent.com/python/asyncio/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/python/asyncio/security
Please reload this pagehttps://patch-diff.githubusercontent.com/python/asyncio/issues/258
Insights https://patch-diff.githubusercontent.com/python/asyncio/pulse
Code https://patch-diff.githubusercontent.com/python/asyncio
Issues https://patch-diff.githubusercontent.com/python/asyncio/issues
Pull requests https://patch-diff.githubusercontent.com/python/asyncio/pulls
Actions https://patch-diff.githubusercontent.com/python/asyncio/actions
Projects https://patch-diff.githubusercontent.com/python/asyncio/projects
Wiki https://patch-diff.githubusercontent.com/python/asyncio/wiki
Security https://patch-diff.githubusercontent.com/python/asyncio/security
Insights https://patch-diff.githubusercontent.com/python/asyncio/pulse
Graceful loop shutdown with running executor taskshttps://patch-diff.githubusercontent.com/python/asyncio/issues/258#top
https://patch-diff.githubusercontent.com/asvetlov
https://github.com/asvetlov
https://github.com/asvetlov
asvetlovhttps://github.com/asvetlov
on Jul 26, 2015https://github.com/python/asyncio/issues/258#issue-97295261
asvetlovhttps://patch-diff.githubusercontent.com/asvetlov
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.