Skip to content

<dict> multiple operations of dict causes core dump of Python interpreter. #87354

Closed

Description

@CharlesFengY
BPO 43188
Nosy @rhettinger, @terryjreedy, @methane, @CharlesFengY

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2021-02-10.09:44:21.101>
labels = ['interpreter-core', '3.9', 'type-crash']
title = '<dict> multiple operations of dict causes core dump of Python interpreter.'
updated_at = <Date 2021-02-13.05:07:49.877>
user = 'https://github.com/CharlesFengY'

bugs.python.org fields:

activity = <Date 2021-02-13.05:07:49.877>
actor = 'terry.reedy'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Interpreter Core']
creation = <Date 2021-02-10.09:44:21.101>
creator = 'CharlesFengY'
dependencies = []
files = []
hgrepos = []
issue_num = 43188
keywords = []
message_count = 4.0
messages = ['386766', '386811', '386812', '386907']
nosy_count = 4.0
nosy_names = ['rhettinger', 'terry.reedy', 'methane', 'CharlesFengY']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue43188'
versions = ['Python 3.9']

Activity

  1. CharlesFengY commented on Feb 10, 2021

    CharlesFengYmannequin
    MannequinAuthor

    In the following programs, we call check_reentrant_insertion("s") twice, after multiple of update and clear of dict, the Python interpreter crashes.
    +++++++++++++++++++++++++++++++++++++++++++
    def check_reentrant_insertion(mutate):

            class Mutating:
                def __del__(self):
                    mutate(d)
    
            d = {k: Mutating() for k in 'abcdefghijklmnopqr'}
            for k in list(d):
                d[k] = k
    
    def test_reentrant_insertion():
    
        check_reentrant_insertion("s")
    
        def mutate(d):
            d.update(DictTest.__dict__)
            d.clear()
        check_reentrant_insertion(test_reentrant_insertion())
    
    test_reentrant_insertion()
    +++++++++++++++++++++++++++++++++++++++++

    System Info: Ubuntu 16.04
    Python Version: Python 3.9.1

  2. added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Feb 10, 2021
  3. rhettinger commented on Feb 10, 2021

    @rhettinger
    Contributor

    I can confirm this crashes.

  4. methane commented on Feb 10, 2021

    @methane
    Member

    Is this the crash you are reporting?

    Exception ignored in: <function check_reentrant_insertion.<locals>.Mutating.__del__ at 0x100d35af0>
    Traceback (most recent call last):
      File "/Users/methane/work/python/cpython/PC/xxx.py", line 5, in __del__
        mutate(d)
    TypeError: 'str' object is not callable
    Exception ignored in: <function check_reentrant_insertion.<locals>.Mutating.__del__ at 0x100d35c10>
    Traceback (most recent call last):
      File "/Users/methane/work/python/cpython/PC/xxx.py", line 5, in __del__
    Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow.
    Python runtime state: initialized
    
    Current thread 0x000000010072bd40 (most recent call first):
      File "/Users/methane/work/python/cpython/xxx.py", line 9 in check_reentrant_insertion
      File "/Users/methane/work/python/cpython/xxx.py", line 13 in test_reentrant_insertion
      File "/Users/methane/work/python/cpython/xxx.py", line 18 in test_reentrant_insertion
    ...
    
  5. terryjreedy commented on Feb 13, 2021

    @terryjreedy
    Member

    Like the code in bpo-43185, bpo-43186, bpo-43187, this works better in 3.10.0a5, so I suspect it is another duplicate.

  6. transferred this issue fromon Apr 10, 2022
  7. kumaraditya303 commented on May 21, 2022

    @kumaraditya303
    Contributor

    On main I get RecursionError this is fixed:

    RecursionError: maximum recursion depth exceeded while calling a Python object
    
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

    3.9 (EOL)end of lifeinterpreter-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

      Issue actions