René's URL Explorer Experiment


Title: Long tasks lead to duplicate messages · Issue #593 · googleapis/python-pubsub · GitHub

Open Graph Title: Long tasks lead to duplicate messages · Issue #593 · googleapis/python-pubsub

X Title: Long tasks lead to duplicate messages · Issue #593 · googleapis/python-pubsub

Description: Hi, I'm having an issue where I have a long process (up to 80 minutes) running on a Kubernetes docker instance. The instance is running Ubuntu 20.04, and I'm using Python 3.8.10. The docker container runs a python worker script, which ru...

Open Graph Description: Hi, I'm having an issue where I have a long process (up to 80 minutes) running on a Kubernetes docker instance. The instance is running Ubuntu 20.04, and I'm using Python 3.8.10. The docker contain...

X Description: Hi, I'm having an issue where I have a long process (up to 80 minutes) running on a Kubernetes docker instance. The instance is running Ubuntu 20.04, and I'm using Python 3.8.10. The docker...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Long tasks lead to duplicate messages","articleBody":"Hi,\r\n\r\nI'm having an issue where I have a long process (up to 80 minutes) running on a Kubernetes docker instance.  The instance is running Ubuntu 20.04, and I'm using Python 3.8.10.  The docker container runs a python worker script, which runs a subprocess.  The subprocess is multi-threaded and can use all threads during some CPU intensive tasks.\r\n\r\nI'm getting a lot of duplicates (about 5 to 10 duplicates).  This is repeatable and probably due to the intense CPU usage.  What is the correct way to handle this?  Thanks in advance.\r\n\r\nMy pip versions are:\r\n\r\n```\r\ngoogle-api-core               1.30.0\r\ngoogle-api-python-client      2.38.0\r\ngoogle-auth                   1.30.2\r\ngoogle-auth-httplib2          0.1.0\r\ngoogle-auth-oauthlib          0.4.4\r\ngoogle-cloud-core             1.7.0\r\ngoogle-cloud-firestore        2.3.4\r\ngoogle-cloud-pubsub           2.9.0\r\n```\r\n\r\nMy worker code is similar to this:\r\n\r\n```\r\nimport shutil\r\nimport argparse\r\nimport time\r\nimport json\r\nimport subprocess, shlex\r\nfrom pathlib import Path\r\nimport concurrent.futures\r\nfrom google.cloud import pubsub_v1\r\n\r\ndef run_command(cmd_title, cmd):\r\n\t\"\"\"Run command string as subprocess\"\"\"\r\n\ttry:\r\n\t\tcmd_list = shlex.split(cmd)\r\n\t\toutput = subprocess.run(cmd_list,check=True)\r\n\t\tprint (output)\r\n\texcept subprocess.CalledProcessError as e:\r\n\t\tprint ('Error running command ',str(cmd))\r\n\t\tprint (e.output)\r\n\t\tpass\r\n\r\n\treturn\r\n\r\ndef worker(\r\n\tproject_id,\r\n\tsubscription):\r\n\t''' receives messages from a pull subscription'''\r\n\r\n\t#create subscriber\r\n\tsubscriber = pubsub_v1.SubscriberClient()\r\n\tsubscription_path = subscriber.subscription_path(project_id, subscription)\r\n\tflow_control = pubsub_v1.types.FlowControl(\r\n\t\tmax_messages=1, \r\n\t\tmax_duration_per_lease_extension = 60,\r\n\t\tmax_lease_duration = 7200)\r\n\r\n\tdef callback(message):\r\n\t\tprint ('Received message {} of message ID {}'.format(message, message.message_id))\r\n\r\n\t\tcmd = '......'\r\n\t\trun_command('Long Task', cmd)\r\n\r\n\t\t#ack message\r\n\t\tmessage.ack()\r\n\t\tprint('Acknowledged message of message ID {}\\n'.format(message.message_id))\r\n\r\n\tfuture = subscriber.subscribe(subscription_path, callback=callback, flow_control=flow_control)\r\n\tprint('Listening for messages on {}..\\n'.format(subscription_path))\r\n\r\n\t# Wrap subscriber in a 'with' block to automatically call close() when done.\r\n\twith subscriber:\r\n\t\ttry:\r\n\t\t\t# When `timeout` is not set, result() will block indefinitely,\r\n\t\t\t# unless an exception is encountered first.\r\n\t\t\tfuture.result()\r\n\t\texcept:\r\n\t\t\tprint ('Exiting subscriber')\r\n\t\t\tfuture.cancel()\r\n\r\nif __name__ == '__main__':\r\n\tparser = argparse.ArgumentParser(description = 'Worker process')\r\n\tparser.add_argument('-p', '--project_id',default='project_id')\r\n\t\r\n\tparser.add_argument('-s', '--subscription', default='subscription')\r\n\targs = parser.parse_args()\r\n\r\n\t#run worker\r\n\tworker(args.project_id, args.subscription)\r\n```\r\n\r\nThanks in advance,","author":{"url":"https://github.com/jtressle","@type":"Person","name":"jtressle"},"datePublished":"2022-03-01T08:05:06Z","url":"https://github.com/googleapis/python-pubsub/issues/593"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:440ce188-58d7-afb4-4bad-f3244f4efacb
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD97A:1A4904:19D32EE:236406C:6AEC568E
html-safe-nonce5dfb4753e973d99bafb1502309eb9843038be170ee07b000ead0e3aaf4d69f1f
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTdBOjFBNDkwNDoxOUQzMkVFOjIzNjQwNkM6NkFFQzU2OEUiLCJ2aXNpdG9yX2lkIjoiNTQ0MzE5MjgwMTEyMzM5MTExOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac5bb402085f11ea38c7b2b5da4831597b1db302cba56296608be5eba038e62044
hovercard-subject-tagissue:1155001461
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/593/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aa6b78b82b38d91afa2a1d32ac9370779d6e023be47de37622b1b4075e76f279/googleapis/python-pubsub/issues/593
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aa6b78b82b38d91afa2a1d32ac9370779d6e023be47de37622b1b4075e76f279/googleapis/python-pubsub/issues/593
og:image:altHi, I'm having an issue where I have a long process (up to 80 minutes) running on a Kubernetes docker instance. The instance is running Ubuntu 20.04, and I'm using Python 3.8.10. The docker contain...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejtressle
hostnamegithub.com
expected-hostnamegithub.com
None3488dbe5257a92e2a716c5c60d82d398cf6def63a52378c4c79ede7ee87ab2b7
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
release4bf5a08d17949149357af9350daf183c3e7e0a4d
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/googleapis/python-pubsub/issues/593#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-pubsub%2Fissues%2F593
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgoogleapis%2Fpython-pubsub%2Fissues%2F593
Sign uphttps://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/593
Reloadhttps://github.com/googleapis/python-pubsub/issues/593
Reloadhttps://github.com/googleapis/python-pubsub/issues/593
googleapishttps://github.com/googleapis
python-pubsubhttps://github.com/googleapis/python-pubsub
Codehttps://github.com/googleapis/python-pubsub
Issueshttps://github.com/googleapis/python-pubsub/issues
Pull requestshttps://github.com/googleapis/python-pubsub/pulls
Actionshttps://github.com/googleapis/python-pubsub/actions
Projectshttps://github.com/googleapis/python-pubsub/projects
Security and qualityhttps://github.com/googleapis/python-pubsub/security
Insightshttps://github.com/googleapis/python-pubsub/pulse
https://github.com/googleapis/python-pubsub
Long tasks lead to duplicate messageshttps://github.com/googleapis/python-pubsub/issues/593#top
https://github.com/acocuzzo
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
type: questionRequest for information or clarification. Not an issue.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22type%3A%20question%22
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Mar 1, 2022https://github.com/googleapis/python-pubsub/issues/593#issue-1155001461
Nexthttps://github.com/googleapis/python-pubsub/issues/593?timeline_page=1
product-auto-labelhttps://github.com/apps/product-auto-label
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
on Mar 1, 2022https://github.com/googleapis/python-pubsub/issues/593#event-6160041980
meredithslotahttps://github.com/meredithslota
type: questionRequest for information or clarification. Not an issue.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22type%3A%20question%22
on Mar 1, 2022https://github.com/googleapis/python-pubsub/issues/593#event-6163584325
https://github.com/meredithslota
meredithslotahttps://github.com/meredithslota
on Mar 1, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1055667065
https://cloud.google.com/blog/products/data-analytics/handling-duplicate-data-in-streaming-pipeline-using-pubsub-dataflowhttps://cloud.google.com/blog/products/data-analytics/handling-duplicate-data-in-streaming-pipeline-using-pubsub-dataflow
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Mar 1, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1055922147
@meredithslotahttps://github.com/meredithslota
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Mar 2, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1055997996
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Mar 8, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1062201892
@meredithslotahttps://github.com/meredithslota
https://github.com/pradn
pradnhttps://github.com/pradn
on Mar 9, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1063287591
'min_duration_per_lease_extension`https://github.com/googleapis/python-pubsub/blob/2fb6e1533192ae81dceee5c71283169a0a85a015/google/cloud/pubsub_v1/types.py#L165
new exactly-once delivery featurehttps://cloud.google.com/pubsub/docs/exactly-once-delivery
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Mar 10, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1064485597
@pradnhttps://github.com/pradn
https://github.com/pradn
pradnhttps://github.com/pradn
on Mar 30, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1083388059
@jtresslehttps://github.com/jtressle
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Apr 5, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1089312029
@pradnhttps://github.com/pradn
https://github.com/pradn
pradnhttps://github.com/pradn
on Apr 5, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1089323513
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Apr 6, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1089692480
@pradnhttps://github.com/pradn
https://github.com/pradn
pradnhttps://github.com/pradn
on Apr 6, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1090337246
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Apr 6, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1090427913
@pradnhttps://github.com/pradn
https://github.com/pradn
pradnhttps://github.com/pradn
on Apr 6, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1090917308
#593 (comment)https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1089692480
https://github.com/hjtran
hjtranhttps://github.com/hjtran
on Oct 25, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1290972536
@acocuzzohttps://github.com/acocuzzo
https://github.com/acocuzzo
acocuzzohttps://github.com/acocuzzo
on Oct 25, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1291057368
@Gwojdahttps://github.com/Gwojda
https://github.com/Gwojda
Gwojdahttps://github.com/Gwojda
on Oct 26, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1291761018
@hjtranhttps://github.com/hjtran
@jtresslehttps://github.com/jtressle
https://github.com/acocuzzo
acocuzzohttps://github.com/acocuzzo
on Oct 26, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1292050081
@Gwojdahttps://github.com/Gwojda
@jtresslehttps://github.com/jtressle
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Oct 30, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1296351206
@Gwojdahttps://github.com/Gwojda
@acocuzzohttps://github.com/acocuzzo
https://github.com/Gwojda
Gwojdahttps://github.com/Gwojda
on Oct 31, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1296780375
https://github.com/jtressle
jtresslehttps://github.com/jtressle
on Nov 3, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1302242711
@Gwojdahttps://github.com/Gwojda
https://github.com/acocuzzo
acocuzzohttps://github.com/acocuzzo
on Nov 11, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1312088766
@Gwojdahttps://github.com/Gwojda
@jtresslehttps://github.com/jtressle
@hjtranhttps://github.com/hjtran
@YungChunLuhttps://github.com/YungChunLu
https://github.com/googleapis/python-pubsub/releases/tag/v2.13.11https://github.com/googleapis/python-pubsub/releases/tag/v2.13.11
https://cloud.google.com/blog/products/data-analytics/testing-cloud-pubsub-clients-to-maximize-streaming-performancehttps://cloud.google.com/blog/products/data-analytics/testing-cloud-pubsub-clients-to-maximize-streaming-performance
https://github.com/acocuzzo
acocuzzohttps://github.com/acocuzzo
on Nov 11, 2022https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1312090650
@jtresslehttps://github.com/jtressle
https://github.com/YungChunLu
YungChunLuhttps://github.com/YungChunLu
on Feb 9, 2023https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1423528225
@Gwojdahttps://github.com/Gwojda
@jtresslehttps://github.com/jtressle
@hjtranhttps://github.com/hjtran
@YungChunLuhttps://github.com/YungChunLu
https://github.com/googleapis/python-pubsub/releases/tag/v2.13.11https://github.com/googleapis/python-pubsub/releases/tag/v2.13.11
https://cloud.google.com/blog/products/data-analytics/testing-cloud-pubsub-clients-to-maximize-streaming-performancehttps://cloud.google.com/blog/products/data-analytics/testing-cloud-pubsub-clients-to-maximize-streaming-performance
acocuzzohttps://github.com/acocuzzo
status: blockedResolving the issue is dependent on other work.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22status%3A%20blocked%22
on Jul 11, 2023https://github.com/googleapis/python-pubsub/issues/593#event-9789066946
https://github.com/acocuzzo
acocuzzohttps://github.com/acocuzzo
on Jul 11, 2023https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1631048484
https://github.com/acocuzzo
acocuzzohttps://github.com/acocuzzo
on Jul 13, 2023https://github.com/googleapis/python-pubsub/issues/593#issuecomment-1634633413
https://docs.python.org/3/library/concurrency.htmlhttps://docs.python.org/3/library/concurrency.html
https://realpython.com/python-concurrency/https://realpython.com/python-concurrency/
https://pythonspeed.com/articles/python-gil/https://pythonspeed.com/articles/python-gil/
acocuzzohttps://github.com/acocuzzo
completedhttps://github.com/googleapis/python-pubsub/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jul 13, 2023https://github.com/googleapis/python-pubsub/issues/593#event-9813829767
acocuzzohttps://github.com/acocuzzo
status: blockedResolving the issue is dependent on other work.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22status%3A%20blocked%22
on Jul 13, 2023https://github.com/googleapis/python-pubsub/issues/593#event-9813849736
Sign up for freehttps://github.com/signup?return_to=https://github.com/googleapis/python-pubsub/issues/593
Sign in to commenthttps://github.com/login?return_to=https://github.com/googleapis/python-pubsub/issues/593
acocuzzohttps://github.com/acocuzzo
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
type: questionRequest for information or clarification. Not an issue.https://github.com/googleapis/python-pubsub/issues?q=state%3Aopen%20label%3A%22type%3A%20question%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.