Skip to content

Unrecoverable stack overflow with infinite recursion on macOS #131543

Open
@tomMoral

Description

@tomMoral

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

Activity

added
type-crashA hard crash of the interpreter, possibly with a core dump
on Mar 21, 2025
StanFromIreland

StanFromIreland commented on Mar 21, 2025

@StanFromIreland
Contributor

Unable to reproduce with python3.14.0a6 on Linux.

encukou

encukou commented on Mar 21, 2025

@encukou
Member

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

tomMoral

tomMoral commented on Mar 21, 2025

@tomMoral
ContributorAuthor

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)

changed the title [-]Unrecoverable stack overflow with infinite recursion on OSX[/-] [+]Unrecoverable stack overflow with infinite recursion on macOS[/+] on Mar 21, 2025
ned-deily

ned-deily commented on Mar 22, 2025

@ned-deily
Member

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

tomMoral commented on Mar 22, 2025

@tomMoral
ContributorAuthor

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

ned-deily commented on Mar 22, 2025

@ned-deily
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

ronaldoussoren commented on Mar 23, 2025

@ronaldoussoren
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-macinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @encukou@ronaldoussoren@tomMoral@ned-deily@StanFromIreland

        Issue actions

          Unrecoverable stack overflow with infinite recursion on macOS · Issue #131543 · python/cpython