Skip to content

3.12.0b2: "Assertion failed: immortal object has less refcnt than expected _Py_IMMORTAL_REFCNT" #105587

Closed
@The-Compiler

Description

@The-Compiler

Crash report

When I run my project with Python 3.12, sometimes on exit I get the error below.

Given the circumstances, it seems almost impossible to construct a minimal example with this. I'd appreciate more information on how to best track the source of this down... See comments below for a simpler reproducer.

If you want to try reproducing as is, getting a --with-pydebug Python 3.12.0b2 and then installing requirements.txt and misc/requirements/requirements-pyqt-6.txt followed by a python3 -m qutebrowser --temp-basedir --debug ":later 2000 quit" should do the trick.

Note that sometimes it segfaults on exit instead, which seems to be a different issue: https://www.riverbankcomputing.com/pipermail/pyqt/2023-June/045331.html

Error messages

./Include/internal/pycore_global_objects_fini_generated.h:15: _PyStaticObject_CheckRefcnt: Assertion failed: immortal object has less refcnt than expected _Py_IMMORTAL_REFCNT
Enable tracemalloc to get the memory block allocation traceback

object address  : 0x55e98b6cb508
object refcount : 4294967294
object type     : 0x55e98b5cb6c0
object type name: bytes
object repr     : b'x'

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: finalizing (tstate=0x000055e98b737490)

Current thread 0x00007fca714f5740 (most recent call first):
  <no Python frame>

This is already with -X tracemalloc, I also tried PYTHONTRACEMALLOC=25 instead. It seems I can't get more information about what's happening there. Happy to go dig into this more e.g. via gdb if someone can tell me what to look for.

Your environment

  • CPython versions tested on: 3.12.0b2 with --with-pydebug
  • Operating system and architecture: Archlinux, amd64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13bugs and security fixesrelease-blockertype-crashA hard crash of the interpreter, possibly with a core dump

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions