René's URL Explorer Experiment


Title: bpo-43785 removed the lock from BZ2File, but on PyPy writing from multiple threads now deadlocks · Issue #100996 · python/cpython · GitHub

Open Graph Title: bpo-43785 removed the lock from BZ2File, but on PyPy writing from multiple threads now deadlocks · Issue #100996 · python/cpython

X Title: bpo-43785 removed the lock from BZ2File, but on PyPy writing from multiple threads now deadlocks · Issue #100996 · python/cpython

Description: Bug report A clear and concise description of what the bug is. Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible. We are working on upgrading PyPy to stdlib v3.10.6. As par...

Open Graph Description: Bug report A clear and concise description of what the bug is. Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible. We are working on ...

X Description: Bug report A clear and concise description of what the bug is. Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible. We are working on ...

Opengraph URL: https://github.com/python/cpython/issues/100996

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"bpo-43785 removed the lock from BZ2File, but on PyPy writing from multiple threads now deadlocks","articleBody":"\u003c!--\r\n  If you're new to Python and you're not sure whether what you're experiencing is a bug, the CPython issue tracker is not\r\n  the right place to seek help. Consider the following options instead:\r\n\r\n  - reading the Python tutorial: https://docs.python.org/3/tutorial/\r\n  - posting in the \"Users\" category on discuss.python.org: https://discuss.python.org/c/users/7\r\n  - emailing the Python-list mailing list: https://mail.python.org/mailman/listinfo/python-list\r\n  - searching our issue tracker (https://github.com/python/cpython/issues) to see if\r\n    your problem has already been reported\r\n-->\r\n\r\n# Bug report\r\n\r\nA clear and concise description of what the bug is.\r\nInclude a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible.\r\n\r\nWe are working on upgrading PyPy to stdlib v3.10.6. As part of that work, we merge the contents of `Lib/*` to a py3.10 branch of PyPy and run the tests. We are seeing deadlocks in the `Lib/test/test_bz2.py` tests, specifically in the [testThreading](https://github.com/python/cpython/blob/eecd422d1ba849f0724962666ba840581217812b/Lib/test/test_bz2.py#L500) test. I can confirm that restoring the lock removed in #25299 (but only the part when writing to `self.fp`) breaks the deadlock:\r\n\r\n```diff\r\n--- a/lib-python/3/bz2.py       Thu Jan 12 16:22:35 2023 +0200\r\n+++ b/lib-python/3/bz2.py       Thu Jan 12 20:27:36 2023 +0200\r\n@@ -13,6 +13,7 @@\r\n import io\r\n import os\r\n import _compression\r\n+from threading import RLock\r\n \r\n from _bz2 import BZ2Compressor, BZ2Decompressor\r\n \r\n@@ -52,6 +53,9 @@\r\n         If mode is 'r', the input file may be the concatenation of\r\n         multiple compressed streams.\r\n         \"\"\"\r\n+        # This lock must be recursive, so that BufferedIOBase's\r\n+        # writelines() does not deadlock.\r\n+        self._lock = RLock()\r\n         self._fp = None\r\n         self._closefp = False\r\n         self._mode = _MODE_CLOSED\r\n@@ -227,9 +231,10 @@\r\n             data = memoryview(data)\r\n             length = data.nbytes\r\n \r\n-        compressed = self._compressor.compress(data)\r\n-        self._fp.write(compressed)\r\n-        self._pos += length\r\n+        with self._lock:\r\n+            compressed = self._compressor.compress(data)\r\n+            self._fp.write(compressed)\r\n+            self._pos += length\r\n         return length\r\n \r\n     def writelines(self, seq):\r\n```\r\n\r\n# Your environment\r\nPyPy on the py3.10 branch, on Ubuntu 20.04.\r\n\r\nDoes CPython have a different locking mechanism for writing to a file to prevent this?\r\n\r\nxref @methane. I think the intention of the original issue was to improve reading speed, I don't see anything in the comments about writing.","author":{"url":"https://github.com/mattip","@type":"Person","name":"mattip"},"datePublished":"2023-01-12T18:32:38Z","url":"https://github.com/python/cpython/issues/100996"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:08b0714f-687f-f031-2458-44e471fe8605
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA390:1BD25B:CC7F36:1191039:6B00B495
html-safe-nonceb48e9d3c8ce55b3c41fbba6f8dfff8f60dbe87cbcd89b022566822a205d38f12
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzkwOjFCRDI1QjpDQzdGMzY6MTE5MTAzOTo2QjAwQjQ5NSIsInZpc2l0b3JfaWQiOiI4MDg0Mjk3OTQ2NjkyMTA1MzY1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac6d8d552105862723708d8f6931d90ea7eac210759eb32c78bcef9898e41c0124
hovercard-subject-tagissue:1531182838
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/cpython/100996/issue_layout
twitter:imagehttps://opengraph.githubassets.com/c242151b01c4c2ab2d8221bde891be42f89fbbad151ac3c0d0d779c54d66baeb/python/cpython/issues/100996
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/c242151b01c4c2ab2d8221bde891be42f89fbbad151ac3c0d0d779c54d66baeb/python/cpython/issues/100996
og:image:altBug report A clear and concise description of what the bug is. Include a minimal, reproducible example (https://stackoverflow.com/help/minimal-reproducible-example), if possible. We are working on ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemattip
hostnamegithub.com
expected-hostnamegithub.com
None1d07c25977adfc5ff6acb0a962a9bc168c07afbda6fef765f9761c350c2ae4a2
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
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
release5429cbfc6aca8c7b9a086a3c8f47400346f38cc9
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/cpython/issues/100996#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F100996
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%2Fpython%2Fcpython%2Fissues%2F100996
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=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/100996
Reloadhttps://github.com/python/cpython/issues/100996
Reloadhttps://github.com/python/cpython/issues/100996
pythonhttps://github.com/python
cpythonhttps://github.com/python/cpython
Codehttps://github.com/python/cpython
Issues5k+ (5k+)https://github.com/python/cpython/issues
Pull requests2.4k (2.4k)https://github.com/python/cpython/pulls
Actionshttps://github.com/python/cpython/actions
Projectshttps://github.com/python/cpython/projects
Security and qualityhttps://github.com/python/cpython/security
Insightshttps://github.com/python/cpython/insights
https://github.com/python/cpython
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/100996
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/100996
bpo-43785 removed the lock from BZ2File, but on PyPy writing from multiple threads now deadlockshttps://github.com/python/cpython/issues/100996#top
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
https://github.com/mattip
mattiphttps://github.com/mattip
on Jan 12, 2023https://github.com/python/cpython/issues/100996#issue-1531182838
https://stackoverflow.com/help/minimal-reproducible-examplehttps://stackoverflow.com/help/minimal-reproducible-example
testThreadinghttps://github.com/python/cpython/blob/eecd422d1ba849f0724962666ba840581217812b/Lib/test/test_bz2.py#L500
#25299https://github.com/python/cpython/pull/25299
@methanehttps://github.com/methane
mattiphttps://github.com/mattip
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%22
on Jan 12, 2023https://github.com/python/cpython/issues/100996#event-8214331815
https://github.com/mattip
mattiphttps://github.com/mattip
on Jan 12, 2023https://github.com/python/cpython/issues/100996#issuecomment-1380953586
#87951https://github.com/python/cpython/issues/87951
https://github.com/methane
methanehttps://github.com/methane
on Jan 13, 2023https://github.com/python/cpython/issues/100996#issuecomment-1381383679
#51454https://github.com/python/cpython/issues/51454
https://gist.github.com/methane/92fef8980cb4d11e88959d067904e891https://gist.github.com/methane/92fef8980cb4d11e88959d067904e891
https://github.com/mattip
mattiphttps://github.com/mattip
on Jan 13, 2023https://github.com/python/cpython/issues/100996#issuecomment-1381442381
mattiphttps://github.com/mattip
completedhttps://github.com/python/cpython/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jan 13, 2023https://github.com/python/cpython/issues/100996#event-8218251057
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/cpython/issues/100996
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/cpython/issues/100996
type-bugAn unexpected behavior, bug, or errorhttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-bug%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.