GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-120974: Make asyncio `swap_current_task` safe in free-threaded build by colesbury · Pull Request #122317 · python/cpython

Conversation

@colesbury

@colesbury colesbury commented Jul 26, 2024 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Use a critical section around the modifications to current_tasks so that the swapping is atomic.

  • Issue: asyncio thread-safety issues in the free-threaded build #120974

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@colesbury
pythongh-120974: Make asyncio swap_current_task safe in free-thread…
846f6f8
…ed build

Use a critical section around the modifications to `current_tasks`.
@colesbury colesbury added skip news needs backport to 3.13 only security fixes labels Jul 26, 2024
@colesbury
colesbury requested review from Fidget-Spinner and kumaraditya303 July 26, 2024 16:48
@colesbury
colesbury requested review from 1st1, asvetlov, gvanrossum, markshannon, methane and willingc as code owners July 26, 2024 16:48
@bedevere-app bedevere-app Bot mentioned this pull request Jul 26, 2024
asyncio thread-safety issues in the free-threaded build #120974
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Jul 26, 2024
@colesbury

colesbury commented Jul 26, 2024

Copy link
Copy Markdown
Contributor Author

!buildbot nogil refleaks

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot

bedevere-bot commented Jul 26, 2024

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @colesbury for commit 846f6f8 🤖

The command will test the builders whose names match following regular expression: nogil refleaks

The builders matched are:

  • AMD64 Fedora Rawhide NoGIL refleaks PR
  • PPC64LE Fedora Rawhide NoGIL refleaks PR
  • aarch64 Fedora Rawhide NoGIL refleaks PR
  • AMD64 Ubuntu NoGIL Refleaks PR
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303
kumaraditya303 reviewed Jul 27, 2024
View reviewed changes
Comment thread Modules/_asynciomodule.c Resolved

Uh oh!

There was an error while loading. Please reload this page.

@colesbury
Use _PyDict_GetItemRef_KnownHash_LockHeld
7df06fc
@colesbury
colesbury requested a review from kumaraditya303 July 29, 2024 16:52
kumaraditya303
kumaraditya303 approved these changes Jul 31, 2024
View reviewed changes
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Jul 31, 2024
@kumaraditya303
kumaraditya303 merged commit b5e6fb3 into python:main Aug 2, 2024
@miss-islington-app

miss-islington-app Bot commented Aug 2, 2024

Copy link
Copy Markdown

Thanks @colesbury for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Aug 2, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 2, 2024
@colesbury @miss-islington
pythongh-120974: Make asyncio swap_current_task safe in free-thread…
6a87edc
…ed build (pythonGH-122317)

* pythongh-120974: Make asyncio `swap_current_task` safe in free-threaded build
(cherry picked from commit b5e6fb3)

Co-authored-by: Sam Gross <[email protected]>
@bedevere-app

bedevere-app Bot commented Aug 2, 2024

Copy link
Copy Markdown

GH-122612 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Aug 2, 2024
kumaraditya303 pushed a commit that referenced this pull request Aug 2, 2024
@miss-islington @colesbury
[3.13] gh-120974: Make asyncio swap_current_task safe in free-threa…
c1efeb3
…ded build (GH-122317) (#122612)

gh-120974: Make asyncio `swap_current_task` safe in free-threaded build (GH-122317)

* gh-120974: Make asyncio `swap_current_task` safe in free-threaded build
(cherry picked from commit b5e6fb3)

Co-authored-by: Sam Gross <[email protected]>
@bedevere-bot

bedevere-bot commented Aug 2, 2024

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot iOS ARM64 Simulator 3.13 has failed when building commit c1efeb3.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#builders/1386/builds/461) and take a look at the build logs.
  4. Check if the failure is related to this commit (c1efeb3) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#builders/1386/builds/461

Failed tests:

  • test_httplib

Failed subtests:

  • testHTTPConnectionSourceAddress - test.test_httplib.SourceAddressTest.testHTTPConnectionSourceAddress

Summary of the results of the build (if available):

==

Click to see traceback logs
Traceback (most recent call last):
  File "/Users/buildbot/Library/Developer/XCTestDevices/0CD06645-FC15-4514-B5DC-AEF3ED24C912/data/Containers/Bundle/Application/1AE2CD3C-EBB6-482B-B920-80647D6C686A/iOSTestbed.app/python/lib/python3.13/test/test_httplib.py", line 1778, in testHTTPConnectionSourceAddress
    self.conn.connect()
    ~~~~~~~~~~~~~~~~~^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/0CD06645-FC15-4514-B5DC-AEF3ED24C912/data/Containers/Bundle/Application/1AE2CD3C-EBB6-482B-B920-80647D6C686A/iOSTestbed.app/python/lib/python3.13/http/client.py", line 1001, in connect
    self.sock = self._create_connection(
                ~~~~~~~~~~~~~~~~~~~~~~~^
        (self.host,self.port), self.timeout, self.source_address)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/buildbot/Library/Developer/XCTestDevices/0CD06645-FC15-4514-B5DC-AEF3ED24C912/data/Containers/Bundle/Application/1AE2CD3C-EBB6-482B-B920-80647D6C686A/iOSTestbed.app/python/lib/python3.13/socket.py", line 864, in create_connection
    raise exceptions[0]
  File "/Users/buildbot/Library/Developer/XCTestDevices/0CD06645-FC15-4514-B5DC-AEF3ED24C912/data/Containers/Bundle/Application/1AE2CD3C-EBB6-482B-B920-80647D6C686A/iOSTestbed.app/python/lib/python3.13/socket.py", line 848, in create_connection
    sock.bind(source_address)
    ~~~~~~~~~^^^^^^^^^^^^^^^^
OSError: [Errno 48] Address already in use
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

brandtbucher pushed a commit to brandtbucher/cpython that referenced this pull request Aug 7, 2024
@colesbury @brandtbucher
pythongh-120974: Make asyncio swap_current_task safe in free-thread…
475aeda
…ed build (python#122317)

* pythongh-120974: Make asyncio `swap_current_task` safe in free-threaded build
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
@colesbury @blhsing
pythongh-120974: Make asyncio swap_current_task safe in free-thread…
d3909a4
…ed build (python#122317)

* pythongh-120974: Make asyncio `swap_current_task` safe in free-threaded build
@colesbury
colesbury deleted the gh-120974-asyncio-swap-current-task branch October 30, 2024 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@kumaraditya303 kumaraditya303 kumaraditya303 approved these changes
@Fidget-Spinner Fidget-Spinner Awaiting requested review from Fidget-Spinner
@methane methane Awaiting requested review from methane methane is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@willingc willingc Awaiting requested review from willingc willingc is a code owner

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@colesbury @bedevere-bot @kumaraditya303
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.