Skip to content

Conversation

@ZeroIntensity
Copy link
Member

@ZeroIntensity ZeroIntensity commented May 24, 2025

This is a reapplication of #128640, with daemon thread hanging fixed.

The key part that I was missing was this:

for (PyThreadState *p = list; p != NULL; p = p->next) {
    _PyThreadState_SetShuttingDown(p);
}

My fix predated these lines, so it didn't make it in originally.

The reason this only failed on the iOS buildbots was because they're single-process. Out of random choice, I picked 100 seconds as the sleep time, but since the process would exit before that 100 seconds was over on all the other buildbots, there wasn't any problem. On iOS, the test suite continued to run in the same process after the 100 seconds were up, so the daemon threads would start trying to run again under a deallocated interpreter, causing all sorts of weird crashes.

@bedevere-bot

This comment was marked as outdated.

@ZeroIntensity ZeroIntensity added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 24, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit a569355 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134606%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label May 24, 2025
@ZeroIntensity

This comment was marked as outdated.

@ZeroIntensity

This comment was marked as outdated.

@bedevere-bot

This comment was marked as outdated.

@ZeroIntensity
Copy link
Member Author

!buildbot refleak

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit f85a291 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134606%2Fmerge

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

The builders matched are:

  • aarch64 Fedora Rawhide NoGIL refleaks PR
  • AMD64 Fedora Rawhide NoGIL refleaks PR
  • PPC64LE RHEL8 Refleaks PR
  • PPC64LE Fedora Rawhide NoGIL refleaks PR
  • PPC64LE CentOS9 Refleaks PR
  • s390x Fedora Rawhide NoGIL refleaks PR
  • AMD64 Fedora Stable Refleaks PR
  • AMD64 RHEL8 Refleaks PR
  • AMD64 Windows11 Refleaks PR
  • aarch64 Fedora Stable Refleaks PR
  • AMD64 Fedora Rawhide Refleaks PR
  • ARM64 MacOS M1 Refleaks NoGIL PR
  • aarch64 Fedora Rawhide Refleaks PR
  • aarch64 RHEL8 Refleaks PR
  • s390x RHEL8 Refleaks PR
  • s390x Fedora Rawhide Refleaks PR
  • AMD64 FreeBSD Refleaks PR
  • aarch64 CentOS9 Refleaks PR
  • AMD64 CentOS9 NoGIL Refleaks PR
  • PPC64LE Fedora Stable Refleaks PR
  • PPC64LE Fedora Rawhide Refleaks PR
  • s390x RHEL9 Refleaks PR
  • AMD64 CentOS9 Refleaks PR
  • s390x Fedora Stable Refleaks PR

@ZeroIntensity
Copy link
Member Author

@ericsnowcurrently Yay, buildbots passed on this one!

Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like with gh-128640, mostly LGTM. I've left a few minor comments.

@bedevere-app
Copy link

bedevere-app bot commented May 27, 2025

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@ZeroIntensity

This comment has been minimized.

@ZeroIntensity ZeroIntensity added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 8, 2025
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @ZeroIntensity for commit 62bd653 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F134606%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jun 8, 2025
These cause crashes due to an existing bug with subinterpreters.
@ZeroIntensity
Copy link
Member Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Jun 17, 2025

Thanks for making the requested changes!

@ericsnowcurrently: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from ericsnowcurrently June 17, 2025 19:04
Copy link
Member

@ericsnowcurrently ericsnowcurrently left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZeroIntensity ZeroIntensity merged commit a648813 into python:main Sep 17, 2025
48 of 49 checks passed
@ZeroIntensity ZeroIntensity deleted the fix-subinterp-thread-shutdown branch September 17, 2025 15:14
@miss-islington-app
Copy link

Thanks @ZeroIntensity for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 17, 2025
…on with fixed daemon thread support (pythonGH-134606)

This reapplies pythonGH-128640.
(cherry picked from commit a648813)

Co-authored-by: Peter Bierma <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Sep 17, 2025

GH-139050 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Sep 17, 2025
ZeroIntensity added a commit that referenced this pull request Oct 7, 2025
…ion with fixed daemon thread support (GH-134606) (GH-139050)

gh-128639: Don't assume one thread in subinterpreter finalization with fixed daemon thread support (GH-134606)

This reapplies GH-128640.
(cherry picked from commit a648813)

Co-authored-by: Peter Bierma <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants