René's URL Explorer Experiment


Title: Deadlock in streaming_pull_manager and ResumableBidiRpc after receiving 504 deadline exceeded error · Issue #74 · googleapis/python-pubsub · GitHub

Open Graph Title: Deadlock in streaming_pull_manager and ResumableBidiRpc after receiving 504 deadline exceeded error · Issue #74 · googleapis/python-pubsub

X Title: Deadlock in streaming_pull_manager and ResumableBidiRpc after receiving 504 deadline exceeded error · Issue #74 · googleapis/python-pubsub

Description: Environment details OS type and version: alpine 3.11 Python version: 3.7.7 pip version: 20.0.2 google-cloud-pubsub version: 1.4.2 Steps to reproduce Start subscriber client Wait for 10 minutes (server should return 504 Deadline Exceeded ...

Open Graph Description: Environment details OS type and version: alpine 3.11 Python version: 3.7.7 pip version: 20.0.2 google-cloud-pubsub version: 1.4.2 Steps to reproduce Start subscriber client Wait for 10 minutes (ser...

X Description: Environment details OS type and version: alpine 3.11 Python version: 3.7.7 pip version: 20.0.2 google-cloud-pubsub version: 1.4.2 Steps to reproduce Start subscriber client Wait for 10 minutes (ser...

Opengraph URL: https://github.com/googleapis/python-pubsub/issues/74

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Deadlock in streaming_pull_manager and ResumableBidiRpc after receiving 504 deadline exceeded error","articleBody":"#### Environment details\r\n\r\n  - OS type and version: alpine 3.11\r\n  - Python version: 3.7.7\r\n  - pip version: 20.0.2\r\n  - `google-cloud-pubsub` version: 1.4.2\r\n\r\n#### Steps to reproduce\r\n\r\n  1. Start subscriber client\r\n  2. Wait for 10 minutes (server should return 504 Deadline Exceeded error)\r\n  3. Messages no longer received and heartbeat no longer sent\r\n\r\nHere are the debug logs just after 10 mins.\r\n```\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:The current deadline value is 10 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:Snoozing lease management for 7.152175 seconds.\r\nINFO:google.cloud.pubsub_v1.subscriber._protocol.streaming_pull_manager:Observed non-terminating stream error 504 Deadline Exceeded\r\nINFO:google.cloud.pubsub_v1.subscriber._protocol.streaming_pull_manager:Observed recoverable stream error 504 Deadline Exceeded\r\nDEBUG:google.api_core.bidi:Re-opening stream from gRPC callback.\r\nDEBUG:google.api_core.bidi:Empty queue and inactive call, exiting request generator.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:The current deadline value is 10 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:Snoozing lease management for 4.379558 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:The current deadline value is 10 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:Snoozing lease management for 7.720803 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:The current deadline value is 10 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:Snoozing lease management for 3.224825 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:The current deadline value is 10 seconds.\r\nDEBUG:google.cloud.pubsub_v1.subscriber._protocol.leaser:Snoozing lease management for 0.857948 seconds.\r\n```\r\n\r\nLooking at the logs, I'm expected to see `_LOGGER.debug(\"Call to retryable %r caused %s.\", method, exc)` since it should be printed on error https://github.com/googleapis/python-api-core/blob/5e5559202891f7e5b6c22c2cbc549e1ec26eb857/google/api_core/bidi.py#L508. However, the message was not printed so the thread was stuck acquiring `self._operational_lock`.\r\n\r\nI've sampled the top functions running on all threads after getting into the deadlock state (attached as stacktrace below). The heartbeater's background thread seems to be frequently holding the lock as it performs the `is_active` check https://github.com/googleapis/python-pubsub/blob/master/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L425. I'm not sure why it's not being released.\r\n\r\n#### Code example\r\n\r\n```python\r\nimport logging\r\n\r\nfrom google.cloud.pubsub_v1 import SubscriberClient\r\n\r\n\r\ndef main():\r\n    logging.basicConfig(level=logging.DEBUG)\r\n\r\n    client = SubscriberClient()\r\n    sub = client.subscription_path(\"project\", \"subscription\")\r\n\r\n    def callback(message):\r\n        print(message)\r\n        message.ack()\r\n\r\n    future = client.subscribe(sub, callback)\r\n\r\n    try:\r\n        future.result()\r\n    except KeyboardInterrupt:\r\n        future.cancel()\r\n\r\nif __name__ == \"__main__\":\r\n    main()\r\n```\r\n\r\n#### Stack trace\r\n```\r\nCollecting samples from 'python main.py' (python v3.7.7)\r\nTotal Samples 2000\r\nGIL: 0.00%, Active: 12.00%, Threads: 17\r\n\r\n  %Own   %Total  OwnTime  TotalTime  Function (filename:line)\r\n 10.00%  10.00%    1.94s     1.94s   _worker (concurrent/futures/thread.py:78)\r\n  2.00%   2.00%   0.640s    0.640s   _recoverable (api_core/bidi.py:508)\r\n  0.00%   0.00%   0.330s    0.330s   is_active (api_core/bidi.py:578)\r\n  0.00%   0.00%   0.000s    0.330s   heartbeat (pubsub_v1/subscriber/_protocol/streaming_pull_manager.py:425)\r\n  0.00%  12.00%   0.000s     2.91s   _bootstrap (threading.py:890)\r\n  0.00%  12.00%   0.000s     2.91s   _bootstrap_inner (threading.py:926)\r\n  0.00%   2.00%   0.000s    0.640s   recv (api_core/bidi.py:562)\r\n  0.00%  12.00%   0.000s     2.91s   run (threading.py:870)\r\n  0.00%   0.00%   0.000s    0.330s   heartbeat (pubsub_v1/subscriber/_protocol/heartbeater.py:40)\r\n  0.00%   2.00%   0.000s    0.640s   _thread_main (api_core/bidi.py:655)\r\n```","author":{"url":"https://github.com/sweatybridge","@type":"Person","name":"sweatybridge"},"datePublished":"2020-04-16T07:34:13.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/74/python-pubsub/issues/74"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:5765bdb0-ec06-b252-677f-6167578dd9bd
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC038:2B367:C40DE9:10942A4:6A4D496D
html-safe-noncebd924afa7ba533554f3f4e59adde424cf433a76e2a3d00bcdbd80dba2cc09f15
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDM4OjJCMzY3OkM0MERFOToxMDk0MkE0OjZBNEQ0OTZEIiwidmlzaXRvcl9pZCI6IjI1MTQ2NzA5OTUzMDc4NDE5MDEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacc09b9d20c000daac29ac92ef5b47716bc03905e982a5c547dcda19b162b92b6d
hovercard-subject-tagissue:600813839
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/googleapis/python-pubsub/74/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2f54001fea64e8f7452137ea052f789cfbc30809e653690ce3bbf7b5c6add77a/googleapis/python-pubsub/issues/74
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2f54001fea64e8f7452137ea052f789cfbc30809e653690ce3bbf7b5c6add77a/googleapis/python-pubsub/issues/74
og:image:altEnvironment details OS type and version: alpine 3.11 Python version: 3.7.7 pip version: 20.0.2 google-cloud-pubsub version: 1.4.2 Steps to reproduce Start subscriber client Wait for 10 minutes (ser...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesweatybridge
hostnamegithub.com
expected-hostnamegithub.com
None92571a8944142227b7e19cd10918b1ddd06e5066c1ad5bc7e4769cf6140a87e6
turbo-cache-controlno-preview
go-importgithub.com/googleapis/python-pubsub git https://github.com/googleapis/python-pubsub.git
octolytics-dimension-user_id16785467
octolytics-dimension-user_logingoogleapis
octolytics-dimension-repository_id226992581
octolytics-dimension-repository_nwogoogleapis/python-pubsub
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id226992581
octolytics-dimension-repository_network_root_nwogoogleapis/python-pubsub
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
release56fc8347865a14e2ec811533d68f929cf4e0ec19
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/googleapis/python-pubsub/issues/74#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-pubsub%2Fissues%2F74
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
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
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
GitHub Starshttps://stars.github.com
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://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-pubsub%2Fissues%2F74
Sign up https://github.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=googleapis%2Fpython-pubsub
Reloadhttps://github.com/googleapis/python-pubsub/issues/74
Reloadhttps://github.com/googleapis/python-pubsub/issues/74
Reloadhttps://github.com/googleapis/python-pubsub/issues/74
Please reload this pagehttps://github.com/googleapis/python-pubsub/issues/74
googleapis https://github.com/googleapis
python-pubsubhttps://github.com/googleapis/python-pubsub
Notifications https://github.com/login?return_to=%2Fgoogleapis%2Fpython-pubsub
Fork 214 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-pubsub
Star 430 https://github.com/login?return_to=%2Fgoogleapis%2Fpython-pubsub
Code https://github.com/googleapis/python-pubsub
Issues 0 https://github.com/googleapis/python-pubsub/issues
Pull requests 0 https://github.com/googleapis/python-pubsub/pulls
Actions https://github.com/googleapis/python-pubsub/actions
Projects https://github.com/googleapis/python-pubsub/projects
Security and quality 0 https://github.com/googleapis/python-pubsub/security
Insights https://github.com/googleapis/python-pubsub/pulse
Code https://github.com/googleapis/python-pubsub
Issues https://github.com/googleapis/python-pubsub/issues
Pull requests https://github.com/googleapis/python-pubsub/pulls
Actions https://github.com/googleapis/python-pubsub/actions
Projects https://github.com/googleapis/python-pubsub/projects
Security and quality https://github.com/googleapis/python-pubsub/security
Insights https://github.com/googleapis/python-pubsub/pulse
#76https://github.com/googleapis/python-pubsub/pull/76
Deadlock in streaming_pull_manager and ResumableBidiRpc after receiving 504 deadline exceeded errorhttps://github.com/googleapis/python-pubsub/issues/74#top
#76https://github.com/googleapis/python-pubsub/pull/76
https://github.com/pradn
api: pubsubIssues related to the googleapis/python-pubsub API.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22api%3A%20pubsub%22
priority: p2Moderately-important priority. Fix may not be included in next release.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22priority%3A%20p2%22
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
https://github.com/sweatybridge
sweatybridgehttps://github.com/sweatybridge
on Apr 16, 2020https://github.com/googleapis/python-pubsub/issues/74#issue-600813839
https://github.com/googleapis/python-api-core/blob/5e5559202891f7e5b6c22c2cbc549e1ec26eb857/google/api_core/bidi.py#L508https://github.com/googleapis/python-api-core/blob/5e5559202891f7e5b6c22c2cbc549e1ec26eb857/google/api_core/bidi.py#L508
https://github.com/googleapis/python-pubsub/blob/master/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L425https://github.com/googleapis/python-pubsub/blob/master/google/cloud/pubsub_v1/subscriber/_protocol/streaming_pull_manager.py#L425
pradnhttps://github.com/pradn
api: pubsubIssues related to the googleapis/python-pubsub API.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22api%3A%20pubsub%22
priority: p2Moderately-important priority. Fix may not be included in next release.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22priority%3A%20p2%22
type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22type%3A%20bug%22
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.