MagicStack/uvloop

test_cython_coro_is_coroutine: python: Objects/codeobject.c:771: PyCode_Addr2Line: Assertion `addrq >= 0 && addrq < _PyCode_NBYTES(co)' failed.

mgorny opened this issue · 1 comments

mgorny commented
  • uvloop version: v0.18.0 (5ddf38b), also earier
  • Python version: 3.11.6
  • Platform: Gentoo Linux amd64
  • Can you reproduce the bug with PYTHONASYNCIODEBUG in env?: yes
  • Does uvloop behave differently from vanilla asyncio? How?: n/a

When CPython is built with assertions enabled (i.e. configure --with-assertions), test_cython_coro_is_coroutine is causing a crash:

$ make test
[…]
test_cython_coro_is_coroutine (test_cython.TestCythonIntegration.test_cython_coro_is_coroutine) ... python: Objects/codeobject.c:771: PyCode_Addr2Line: Assertion `addrq >= 0 && addrq < _PyCode_NBYTES(co)' failed.
Backtrace via gdb
#0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x00007f67050a2e2f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
#2  0x00007f6705052cc2 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3  0x00007f670503b4ed in __GI_abort () at abort.c:79
#4  0x00007f670503b415 in __assert_fail_base (fmt=0x7f67051b8b98 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x7f670562f638 "addrq >= 0 && addrq < _PyCode_NBYTES(co)", 
    file=file@entry=0x7f670562f377 "Objects/codeobject.c", line=line@entry=771, 
    function=function@entry=0x7f670562fe50 <__PRETTY_FUNCTION__.12> "PyCode_Addr2Line") at assert.c:92
#5  0x00007f670504b5e2 in __assert_fail (assertion=0x7f670562f638 "addrq >= 0 && addrq < _PyCode_NBYTES(co)", 
    file=0x7f670562f377 "Objects/codeobject.c", line=771, function=0x7f670562fe50 <__PRETTY_FUNCTION__.12> "PyCode_Addr2Line")
    at assert.c:101
#6  0x00007f670538ebb3 in PyCode_Addr2Line (co=0x7f6702fe71b0, addrq=0) at Objects/codeobject.c:771
#7  0x00007f670550ee7c in _PyInterpreterFrame_GetLine (frame=0x7f67004ba3e0) at Python/frame.c:169
#8  0x00007f67053b32e8 in PyFrame_GetLineNumber (f=Frame 0x7f67004ba3e0, for file uvloop/loop.pyx, line ?, in _test_coroutine_1 ())
    at Objects/frameobject.c:43
#9  0x00007f67053b3306 in frame_getlineno (f=Frame 0x7f67004ba3e0, for file uvloop/loop.pyx, line ?, in _test_coroutine_1 (), 
    closure=0x0) at Objects/frameobject.c:50
#10 0x00007f6705395e26 in getset_get (descr=0x7f6704f58840, 
    obj=Frame 0x7f67004ba3e0, for file uvloop/loop.pyx, line ?, in _test_coroutine_1 (), type=<type at remote 0x7f6705785ea0>)
    at Objects/descrobject.c:202
#11 0x00007f67053f8ae5 in _PyObject_GenericGetAttrWithDict (
    obj=Frame 0x7f67004ba3e0, for file uvloop/loop.pyx, line ?, in _test_coroutine_1 (), name='f_lineno', dict=0x0, suppress=0)
    at Objects/object.c:1278
#12 0x00007f67053f8e4b in PyObject_GenericGetAttr (
    obj=Frame 0x7f67004ba3e0, for file uvloop/loop.pyx, line ?, in _test_coroutine_1 (), name='f_lineno') at Objects/object.c:1368
#13 0x00007f67053f7d98 in PyObject_GetAttr (v=Frame 0x7f67004ba3e0, for file uvloop/loop.pyx, line ?, in _test_coroutine_1 (), 
    name='f_lineno') at Objects/object.c:916
#14 0x00007f67054cf45c in _PyEval_EvalFrameDefault (tstate=0x7f67058a9218 <_PyRuntime+166328>, frame=0x7f6705a3ba88, throwflag=0)
    at Python/ceval.c:3452
#15 0x00007f67054bfa5a in _PyEval_EvalFrame (tstate=0x7f67058a9218 <_PyRuntime+166328>, frame=0x7f6705a3b8a8, throwflag=0)
    at ./Include/internal/pycore_ceval.h:73
#16 0x00007f67054e1162 in _PyEval_Vector (tstate=0x7f67058a9218 <_PyRuntime+166328>, func=0x7f67041b42c0, locals=0x0, 
    args=0x7ffffb985bf0, argcount=2, kwnames=0x0) at Python/ceval.c:6425
#17 0x00007f6705385531 in _PyFunction_Vectorcall (func=<function at remote 0x7f67041b42c0>, stack=0x7ffffb985bf0, nargsf=2, 
    kwnames=0x0) at Objects/call.c:393
--Type <RET> for more, q to quit, c to continue without paging--c
#18 0x00007f670538893f in _PyObject_VectorcallTstate (tstate=0x7f67058a9218 <_PyRuntime+166328>, 
    callable=<function at remote 0x7f67041b42c0>, args=0x7ffffb985bf0, nargsf=2, kwnames=0x0) at ./Include/internal/pycore_call.h:92
#19 0x00007f670538914b in method_vectorcall (method=<method at remote 0x7f67031afe40>, args=0x7f6701e5d2b8, nargsf=1, kwnames=0x0)
    at Objects/classobject.c:89
#20 0x00007f6705384e5b in _PyVectorcall_Call (tstate=0x7f67058a9218 <_PyRuntime+166328>, func=0x7f6705388ef7 <method_vectorcall>, 
    callable=<method at remote 0x7f67031afe40>, 
    tuple=(<TextTestResult(failfast=False, failures=[], errors=[], testsRun=122, skipped=[(<Test_AIO_Context(_testMethodName='test_create_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb60>: 'assertTupleEqual', <type at remote 0x7f670578de20>: 'assertSetEqual', <type at remote 0x7f670578e160>: 'assertSetEqual', <type at remote 0x7f67057921a0>: 'assertMultiLineEqual'}, loop=None, _check_unclosed_resources_in_debug=True, _BaseTestCase__unhandled_exceptions=[]) at remote 0x7f6702b38590>, 'this seems to be a bug in asyncio'), (<Test_AIO_Context(_testMethodName='test_create_ssl_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb...(truncated), kwargs={})
    at Objects/call.c:245
#21 0x00007f6705385233 in _PyObject_Call (tstate=0x7f67058a9218 <_PyRuntime+166328>, callable=<method at remote 0x7f67031afe40>, 
    args=(<TextTestResult(failfast=False, failures=[], errors=[], testsRun=122, skipped=[(<Test_AIO_Context(_testMethodName='test_create_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb60>: 'assertTupleEqual', <type at remote 0x7f670578de20>: 'assertSetEqual', <type at remote 0x7f670578e160>: 'assertSetEqual', <type at remote 0x7f67057921a0>: 'assertMultiLineEqual'}, loop=None, _check_unclosed_resources_in_debug=True, _BaseTestCase__unhandled_exceptions=[]) at remote 0x7f6702b38590>, 'this seems to be a bug in asyncio'), (<Test_AIO_Context(_testMethodName='test_create_ssl_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb...(truncated), kwargs={})
    at Objects/call.c:328
#22 0x00007f670538532c in PyObject_Call (callable=<method at remote 0x7f67031afe40>, 
    args=(<TextTestResult(failfast=False, failures=[], errors=[], testsRun=122, skipped=[(<Test_AIO_Context(_testMethodName='test_create_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb60>: 'assertTupleEqual', <type at remote 0x7f670578de20>: 'assertSetEqual', <type at remote 0x7f670578e160>: 'assertSetEqual', <type at remote 0x7f67057921a0>: 'assertMultiLineEqual'}, loop=None, _check_unclosed_resources_in_debug=True, _BaseTestCase__unhandled_exceptions=[]) at remote 0x7f6702b38590>, 'this seems to be a bug in asyncio'), (<Test_AIO_Context(_testMethodName='test_create_ssl_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb...(truncated), kwargs={})
    at Objects/call.c:355
#23 0x00007f67054e4445 in do_call_core (tstate=0x7f67058a9218 <_PyRuntime+166328>, func=<method at remote 0x7f67031afe40>, 
    callargs=(<TextTestResult(failfast=False, failures=[], errors=[], testsRun=122, skipped=[(<Test_AIO_Context(_testMethodName='test_create_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb60>: 'assertTupleEqual', <type at remote 0x7f670578de20>: 'assertSetEqual', <type at remote 0x7f670578e160>: 'assertSetEqual', <type at remote 0x7f67057921a0>: 'assertMultiLineEqual'}, loop=None, _check_unclosed_resources_in_debug=True, _BaseTestCase__unhandled_exceptions=[]) at remote 0x7f6702b38590>, 'this seems to be a bug in asyncio'), (<Test_AIO_Context(_testMethodName='test_create_ssl_server_manual_connection_lost', _outcome=None, _testMethodDoc=None, _cleanups=[], _subtest=None, _type_equality_funcs={<type at remote 0x7f67057889e0>: 'assertDictEqual', <type at remote 0x7f67057874c0>: 'assertListEqual', <type at remote 0x7f670578eb...(truncated), kwdict={}, use_tracing=0)
    at Python/ceval.c:7343
#24 0x00007f67054dc36e in _PyEval_EvalFrameDefault (tstate=0x7f67058a9218 <_PyRuntime+166328>, frame=0x7f6705a3b820, throwflag=0)
    at Python/ceval.c:5367
#25 0x00007f67054bfa5a in _PyEval_EvalFrame (tstate=0x7f67058a9218 <_PyRuntime+166328>, frame=0x7f6705a3b820, throwflag=0)
    at ./Include/internal/pycore_ceval.h:73
#26 0x00007f67054e1162 in _PyEval_Vector (tstate=0x7f67058a9218 <_PyRuntime+166328>, func=0x7f67041b44a0, locals=0x0, 
    args=0x7ffffb988310, argcount=2, kwnames=0x0) at Python/ceval.c:6425
#27 0x00007f6705385531 in _PyFunction_Vectorcall (func=<function at remote 0x7f67041b44a0>, stack=0x7ffffb988310, nargsf=2, 
    kwnames=0x0) at Objects/call.c:393
#28 0x00007f6705384968 in _PyObject_FastCallDictTstate (tstate=0x7f67058a9218 <_PyRuntime+166328>, 
    callable=<function at remote 0x7f67041b44a0>, args=0x7ffffb988310, nargsf=2, kwargs=0x0) at Objects/call.c:141
[…]