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 — Crash on `_PyTuple_Fini` for code using sub interpreters · Issue #112140 · python/cpython

Crash on _PyTuple_Fini for code using sub interpreters #112140

New issue
Copy link
New issue
Copy link
Closed
Closed
Crash on _PyTuple_Fini for code using sub interpreters#112140
Copy link
Labels
topic-subinterpreterstype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@tonybaloney
tonybaloney
opened on Nov 16, 2023
Issue body actions

Crash report

What happened?

In certain cases, the finalization stage of CPython is crashing when free'ing the PyTuple Free lists (see stack trace).

One such example I can consistently reproduce is this import (pip install hypercorn)

import _xxsubinterpreters as interpreters

i = interpreters.create()
interpreters.run_string(i, "from hypercorn.asyncio.run import asyncio_worker")

Output:

Debug memory block at address p=0x10e8393b0: API '�'
    15987178197214944733 bytes originally requested
    The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
        at p-7: 0xdd *** OUCH
        at p-6: 0xdd *** OUCH
        at p-5: 0xdd *** OUCH
        at p-4: 0xdd *** OUCH
        at p-3: 0xdd *** OUCH
        at p-2: 0xdd *** OUCH
        at p-1: 0xdd *** OUCH
    Because memory is corrupted at the start, the count of bytes requested
       may be bogus, and checking the trailing pad bytes may segfault.
    The 8 pad bytes at tail=0xdddddddeec61718d are zsh: segmentation fault  python test_hypercorn.py

Stack trace:

python!_PyObject_DebugDumpAddress (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:2578)
python!_PyMem_DebugCheckAddress (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:2496)
python!_PyMem_DebugRawFree (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:2329)
python!PyMem_RawFree (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:818)
python!_PyObject_Free (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:2023)
python!_PyMem_DebugRawFree (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:2333)
python!_PyMem_DebugFree (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:2466)
python!PyObject_Free (/Users/anthonyshaw/projects/cpython/Objects/obmalloc.c:963)
python!PyObject_GC_Del (/Users/anthonyshaw/projects/cpython/Modules/gcmodule.c:2414)
python!maybe_freelist_clear (/Users/anthonyshaw/projects/cpython/Objects/tupleobject.c:1209)
python!_PyTuple_Fini (/Users/anthonyshaw/projects/cpython/Objects/tupleobject.c:970)
python!finalize_interp_types (/Users/anthonyshaw/projects/cpython/Python/pylifecycle.c:1764)
python!finalize_interp_clear (/Users/anthonyshaw/projects/cpython/Python/pylifecycle.c:1802)
python!Py_FinalizeEx (/Users/anthonyshaw/projects/cpython/Python/pylifecycle.c:2013)
python!Py_RunMain (/Users/anthonyshaw/projects/cpython/Modules/main.c:709)
python!pymain_main (/Users/anthonyshaw/projects/cpython/Modules/main.c:737)
python!Py_BytesMain (/Users/anthonyshaw/projects/cpython/Modules/main.c:761)
python!main (/Users/anthonyshaw/projects/cpython/Programs/python.c:15)
start (Unknown Source:0)

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

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

Python 3.13.0a1+ (heads/main:55f3cce821, Nov 15 2023, 14:40:56) [Clang 14.0.3 (clang-1403.0.22.14.1)]

Activity

  1. tonybaloney
    added
    type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
    on Nov 16, 2023
  2. AlexWaygood
    added
    topic-subinterpreters
    on Nov 16, 2023
  3. github-project-automation
    added this to Subinterpreterson Nov 16, 2023
  4. github-project-automation
    moved this to Todo in Subinterpreterson Nov 16, 2023
  5. ericsnowcurrently commented on Jun 18, 2024

    @ericsnowcurrently
    ericsnowcurrently
    on Jun 18, 2024
    Member
    More actions

    @tonybaloney, is this still a problem? I just tried it on main and did not get a crash.

  6. tonybaloney commented on Jun 18, 2024

    @tonybaloney
    tonybaloney
    on Jun 18, 2024
    ContributorAuthor
    More actions

    I haven't seen this crash for a long time, so closing

    Reacted by Eric Snow
  7. tonybaloney
    closed this as completedon Jun 18, 2024
  8. github-project-automation
    moved this from Todo to Done in Subinterpreterson Jun 18, 2024
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

    topic-subinterpreterstype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

    Projects

    • Subinterpreters
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.