Skip to content

Multiple PyFrameObjects can be created for a single _PyInterpreterFrame #97002

Closed
@davfsa

Description

Crash report

I am not really sure under what circumstances this can occur, as I have not been able to isolate the specific piece of code that triggers this. Thankfully, when trying to re-create the segfault to capture a core dump locally, I have found that I instead got a full traceback, which you can find bellow

Error messages

Segfault
============================= test session starts ==============================
platform linux -- Python 3.11.0rc2, pytest-7.1.3, pluggy-1.0.0
Using --randomly-seed=3689645484
rootdir: /home/runner/work/hikari/hikari, configfile: pyproject.toml
plugins: cov-3.0.0, randomly-3.12.0, asyncio-0.19.0
asyncio: mode=Mode.STRICT
collected 3244 items

tests/hikari/internal/test_aio.py ....................................   [  1%]
tests/hikari/test_templates.py .                                         [  1%]
tests/hikari/impl/test_event_manager.py Fatal Python error: Segmentation fault

Current thread 0x00007f5aff3b8740 (most recent call first):
  File "/opt/hostedtoolcache/Python/3.11.0-rc.2/x64/lib/python3.11/traceback.py", line 366 in _get_code_position
  File "/opt/hostedtoolcache/Python/3.11.0-rc.2/x64/lib/python3.11/traceback.py", line 353 in _walk_tb_with_full_positions
  File "/opt/hostedtoolcache/Python/3.11.0-rc.2/x64/lib/python3.11/traceback.py", line 416 in _extract_from_extended_frame_gen
  File "/opt/hostedtoolcache/Python/3.11.0-rc.2/x64/lib/python3.11/traceback.py", line 688 in __init__
  File "/opt/hostedtoolcache/Python/3.11.0-rc.2/x64/lib/python3.11/traceback.py", line 139 in format_exception
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/unraisableexception.py", line 72 in unraisable_exception_runtest_hook
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/unraisableexception.py", line 83 in pytest_runtest_setup
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_callers.py", line 55 in _multicall
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/runner.py", line 259 in <lambda>
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/runner.py", line 338 in from_call
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/runner.py", line 258 in call_runtest_hook
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/runner.py", line 219 in call_and_report
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/runner.py", line 124 in runtestprotocol
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/runner.py", line 111 in pytest_runtest_protocol
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/main.py", line 347 in pytest_runtestloop
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/main.py", line 322 in _main
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/main.py", line 268 in wrap_session
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/main.py", line 315 in pytest_cmdline_main
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_callers.py", line 39 in _multicall
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_manager.py", line 80 in _hookexec
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pluggy/_hooks.py", line 265 in __call__
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/config/__init__.py", line 164 in main
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/_pytest/config/__init__.py", line 187 in console_main
  File "/home/runner/work/hikari/hikari/.nox/pytest/lib/python3.11/site-packages/pytest/__main__.py", line 5 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main

Extension modules: multidict._multidict, yarl._quoting_c, aiohttp._helpers, aiohttp._http_writer, aiohttp._http_parser, aiohttp._websocket, frozenlist._frozenlist (total: 7)
Traceback
exc = <class 'ResourceWarning'>, value = ResourceWarning('unclosed <socket.socket fd=16, family=1, type=1, proto=0>'), tb = <traceback object at 0x7f1e410ba440>, limit = None, chain = True

    def format_exception(exc, /, value=_sentinel, tb=_sentinel, limit=None, \
                         chain=True):
        """Format a stack trace and the exception information.
    
        The arguments have the same meaning as the corresponding arguments
        to print_exception().  The return value is a list of strings, each
        ending in a newline and some containing internal newlines.  When
        these lines are concatenated and printed, exactly the same text is
        printed as does print_exception().
        """
        value, tb = _parse_value_tb(exc, value, tb)
>       te = TracebackException(type(value), value, tb, limit=limit, compact=True)

chain      = True
exc        = <class 'ResourceWarning'>
limit      = None
tb         = <traceback object at 0x7f1e410ba440>
value      = ResourceWarning('unclosed <socket.socket fd=16, family=1, type=1, proto=0>')

/usr/lib/python3.11/traceback.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.11/traceback.py:688: in __init__
    self.stack = StackSummary._extract_from_extended_frame_gen(
        _seen      = {139767898821088}
        capture_locals = False
        compact    = True
        exc_traceback = <traceback object at 0x7f1e410ba440>
        exc_type   = <class 'ResourceWarning'>
        exc_value  = ResourceWarning('unclosed <socket.socket fd=16, family=1, type=1, proto=0>')
        is_recursive_call = False
        limit      = None
        lookup_lines = True
        max_group_depth = 10
        max_group_width = 15
        self       = <traceback.TracebackException object at 0x7f1e3fddb410>
/usr/lib/python3.11/traceback.py:416: in _extract_from_extended_frame_gen
    for f, (lineno, end_lineno, colno, end_colno) in frame_gen:
        capture_locals = False
        fnames     = set()
        frame_gen  = <generator object _walk_tb_with_full_positions at 0x7f1e3f1ecba0>
        klass      = <class 'traceback.StackSummary'>
        limit      = None
        lookup_lines = True
        result     = []
/usr/lib/python3.11/traceback.py:353: in _walk_tb_with_full_positions
    positions = _get_code_position(tb.tb_frame.f_code, tb.tb_lasti)
        tb         = <traceback object at 0x7f1e410ba440>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

code = <cell at 0x7f1e45de9f60: str object at 0x7f1e45bd80f0>, instruction_index = 0

    def _get_code_position(code, instruction_index):
        if instruction_index < 0:
            return (None, None, None, None)
>       positions_gen = code.co_positions()
E       AttributeError: 'cell' object has no attribute 'co_positions'

code       = <cell at 0x7f1e45de9f60: str object at 0x7f1e45bd80f0>
instruction_index = 0

/usr/lib/python3.11/traceback.py:366: AttributeError

-------- coverage: platform linux, python 3.11.0-candidate-2 ---------

Your environment

  • CPython versions tested on: 3.11.0-rc.2
  • Operating system and architecture: Linux x86_64

Metadata

Assignees

Labels

3.11only security fixes3.12bugs and security fixesrelease-blockersprinttype-crashA hard crash of the interpreter, possibly with a core dump

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions