Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecoverable stack overflow with infinite recursion on macOS #131543

Open
tomMoral opened this issue Mar 21, 2025 · 7 comments
Open

Unrecoverable stack overflow with infinite recursion on macOS #131543

tomMoral opened this issue Mar 21, 2025 · 7 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@tomMoral
Copy link
Contributor

tomMoral commented Mar 21, 2025

Crash report

What happened?

Hello,

In the CI of cloudpickle, we encountered a crash of the python interpreter due to a stack overflow with python3.14.0a6.
Reverting to python3.14.0a5 fixes the error.

This might be related to GH-130398, with a bad detection of the limit of the stack?
I could not test it locally as I don't own a mac.

class A:
    def __getattribute__(self, name):
        return getattr(self, name)


a = A()
print("Testing Recursion Limit")
try:
    a.test
except RecursionError:
    print("Recursion Limit ok")

Output with python3.14.0a5:

Testing Recursion Limit
Recursion Limit ok

Output with python3.14.0a6:

Fatal Python error: _Py_CheckRecursiveCall: Unrecoverable stack overflow (used 3923 kB)
Python runtime state: initialized

Current thread 0x00000001f839cf80 (most recent call first):
  File "/Users/runner/work/cloudpickle/cloudpickle/test_recursion_error.py", line 3 in __getattribute__
  File "/Users/runner/work/cloudpickle/cloudpickle/test_recursion_error.py", line 3 in __getattribute__
  File "/Users/runner/work/cloudpickle/cloudpickle/test_recursion_error.py", line 3 in __getattribute__
....

CPython versions tested on:

3.14

Operating systems tested on:

macOS

Output from running 'python -VV' on the command line:

No response

@tomMoral tomMoral added the type-crash A hard crash of the interpreter, possibly with a core dump label Mar 21, 2025
@StanFromIreland
Copy link
Contributor

Unable to reproduce with python3.14.0a6 on Linux.

@encukou
Copy link
Member

encukou commented Mar 21, 2025

Hi,
Are the logs from that cloudpickle CI run public?

@tomMoral
Copy link
Contributor Author

I was unable to reproduce locally with linux either.

The outputs for both runs with cloudpickle CI are linked in the issue description (sorry it is not super explicit indeed)

@vstinner vstinner changed the title Unrecoverable stack overflow with infinite recursion on OSX Unrecoverable stack overflow with infinite recursion on macOS Mar 21, 2025
@ned-deily
Copy link
Member

ned-deily commented Mar 22, 2025

I can reproduce the crash using any of the python.org macOS Python 3.14 alphas, as well as the latest python.org and MacPorts-supplied Python 3.13(.2) and 3.12(.9) - I didn't try any earlier versions of them. It might be an issue with release vs debug builds and there certainly have been many instances in the past of different stack limits on different platforms, especially on macOS.

@tomMoral
Copy link
Contributor Author

Hello,
In the reported case, it does not happen with 3.14.0a5 on the same platform, so I don't know if it is linked to how it is built (I'm guessing both builds have a similar process).

The exact build from the logs:
3.14.0a5 (working): Download from "https://github.com/actions/python-versions/releases/download/3.14.0-alpha.5-13438582588/python-3.14.0-alpha.5-darwin-arm64.tar.gz"
3.14.0a6 (failing): Download from "https://github.com/actions/python-versions/releases/download/3.14.0-alpha.6-13890321974/python-3.14.0-alpha.6-darwin-arm64.tar.gz"

@ned-deily
Copy link
Member

My apologies! I somehow totally misread your report. Contrary to what I originally wrote, I cannot reproduce the failure with any of those python.org macOS installers, including 3.14.0a5 and a6. I see that the actions/python-versions repo claims to repackage the python.org installers for macOS but I have no insight into how they might do that or what differences Github CI runners might present that might be a factor here. All I can say is that we have our own Github CI jobs for both Intel and Apple Silicon (ARM). And our python.org release installers are tested on a variety of real machines and VMs of both architectures with various macOS versions but not on a Github runner itself.

@ronaldoussoren
Copy link
Contributor

FWIW: The reproducer in the initial message crashes for me with Python 3.14a6, but only for arm64 and not x86_64 (e.g. fatal error with arch -arm64 python3.14 repro.py and no issue with arch -x86_64 python3.14 repro.py). This is with the python.org installer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-mac type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

5 participants