Title: `PyFrame_GetBack` segfaults if called in a `sys.settrace` hook on `3.11.1` · Issue #100536 · python/cpython · GitHub
Open Graph Title: `PyFrame_GetBack` segfaults if called in a `sys.settrace` hook on `3.11.1` · Issue #100536 · python/cpython
X Title: `PyFrame_GetBack` segfaults if called in a `sys.settrace` hook on `3.11.1` · Issue #100536 · python/cpython
Description: Crash report When PyFrame_GetBack is called during a sys.settrace hook in a C extension, it segfaults for some libraries(spacy) Following is a reproducer: https://gist.github.com/sumerc/b254f38c5a620b8d47aba7398b3c7791. Error messages En...
Open Graph Description: Crash report When PyFrame_GetBack is called during a sys.settrace hook in a C extension, it segfaults for some libraries(spacy) Following is a reproducer: https://gist.github.com/sumerc/b254f38c5a6...
X Description: Crash report When PyFrame_GetBack is called during a sys.settrace hook in a C extension, it segfaults for some libraries(spacy) Following is a reproducer: https://gist.github.com/sumerc/b254f38c5a6...
Opengraph URL: https://github.com/python/cpython/issues/100536
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`PyFrame_GetBack` segfaults if called in a `sys.settrace` hook on `3.11.1`","articleBody":"# Crash report\r\n\r\nWhen `PyFrame_GetBack` is called during a `sys.settrace` hook in a C extension, it segfaults for some libraries(`spacy`)\r\nFollowing is a reproducer: https://gist.github.com/sumerc/b254f38c5a620b8d47aba7398b3c7791. \r\n\r\n# Error messages\r\n\r\nEnter any relevant error message caused by the crash, including a core dump if there is one. \r\n\r\nA gdb stack trace: (for more information: the last frame executed was `\u003cframe at 0x7fffd25b2d40, file 'thinc/backends/numpy_ops.pyx', line 1, code __Pyx_PyMODINIT_FUNC PyInit_numpy_ops(void)\u003e`) I also have another application that crashes at the same point but with a different frame: `\u003cframe at 0x7ff6568e4520, file 'stringsource', line 282, code __init__\u003e`. The interesting part is both are Cython functions. Might there be something related with Cython?\r\n\r\n```\r\nThread 1 \"python\" received signal SIGSEGV, Segmentation fault.\r\n0x00007ffff767a548 in _PyFrame_IsIncomplete (frame=0xcdcdcdcdcdcdcdcd) at ./Include/internal/pycore_frame.h:147\r\n147 ./Include/internal/pycore_frame.h: No such file or directory.\r\n(gdb) bt\r\n#0 0x00007ffff767a548 in _PyFrame_IsIncomplete (frame=0xcdcdcdcdcdcdcdcd) at ./Include/internal/pycore_frame.h:147\r\n#1 0x00007ffff767d9e7 in PyFrame_GetBack (frame=0x7fffd03ef120) at Objects/frameobject.c:1326\r\n#2 0x00007ffff60e7bce in PyTraceFunction (obj=0x0, frame=0x7fffd03ef120, what=0, arg=0x0) at main.c:33\r\n#3 0x00007fffd02db71b in ?? () from /home/supo/.pyenv/versions/3.11.1-debug/lib/python3.11/site-packages/thinc/backends/[numpy_ops.cpython-311-x86_64-linux-gnu.so](http://numpy_ops.cpython-311-x86_64-linux-gnu.so/)\r\n#4 0x00007fffd02d4697 in ?? () from /home/supo/.pyenv/versions/3.11.1-debug/lib/python3.11/site-packages/thinc/backends/[numpy_ops.cpython-311-x86_64-linux-gnu.so](http://numpy_ops.cpython-311-x86_64-linux-gnu.so/)\r\n#5 0x00007ffff76bab22 in PyModule_ExecDef (module=0x7fffd16273b0, def=0x7fffd038ba60) at Objects/moduleobject.c:419\r\n#6 0x00007ffff77f38ec in exec_builtin_or_dynamic (mod=0x7fffd16273b0) at Python/import.c:2333\r\n#7 0x00007ffff77f3ab8 in _imp_exec_dynamic_impl (module=0x7ffff7f83bf0, mod=0x7fffd16273b0) at Python/import.c:2407\r\n#8 0x00007ffff77ef0b0 in _imp_exec_dynamic (module=0x7ffff7f83bf0, mod=0x7fffd16273b0) at Python/clinic/import.c.h:474\r\n#9 0x00007ffff76b9170 in cfunction_vectorcall_O (func=0x7ffff7f882f0, args=0x7fffd03e1ff8, nargsf=1, kwnames=0x0) at Objects/methodobject.c:514\r\n#10 0x00007ffff764bf31 in _PyVectorcall_Call (tstate=0x7ffff7d8ba38 \u003c_PyRuntime+166328\u003e, func=0x7ffff76b9065 \u003ccfunction_vectorcall_O\u003e, callable=0x7ffff7f882f0,\r\n tuple=0x7fffd03e1fe0, kwargs=0x7fffd03fc4d0) at Objects/call.c:245\r\n#11 0x00007ffff764c2d9 in _PyObject_Call (tstate=0x7ffff7d8ba38 \u003c_PyRuntime+166328\u003e, callable=0x7ffff7f882f0, args=0x7fffd03e1fe0, kwargs=0x7fffd03fc4d0)\r\n at Objects/call.c:328\r\n#12 0x00007ffff764c3cb in PyObject_Call (callable=0x7ffff7f882f0, args=0x7fffd03e1fe0, kwargs=0x7fffd03fc4d0) at Objects/call.c:355\r\n#13 0x00007ffff77b4158 in do_call_core (tstate=0x7ffff7d8ba38 \u003c_PyRuntime+166328\u003e, func=0x7ffff7f882f0, callargs=0x7fffd03e1fe0, kwdict=0x7fffd03fc4d0,\r\n use_tracing=255) at Python/ceval.c:7329\r\n```\r\n\r\n# Your environment\r\n\r\nI have reproduced same error for Python `3.11.0rc1` on `Ubuntu 18.04`/`x86/64` and a Mac M1. (The same code runs fine on `3.9`)\r\n\r\nUpdate: Reproduced the segfault with `3.11.1` final release, too.\r\n\r\n@pablogsal, Any idea?","author":{"url":"https://github.com/sumerc","@type":"Person","name":"sumerc"},"datePublished":"2022-12-26T14:37:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/100536/cpython/issues/100536"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d68bca3e-e0cb-f17b-f69d-da36ea60ae1f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E6C4:17C6E:25974C3:34E5064:69691AAF |
| html-safe-nonce | 7d29fe33fd37927f6ec46fa1275dd68de79054c64a417a335e7c740b9a714511 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNkM0OjE3QzZFOjI1OTc0QzM6MzRFNTA2NDo2OTY5MUFBRiIsInZpc2l0b3JfaWQiOiI2OTU4MDI1Mjc1MzE2MTgxNjc5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ecce10dae6646bf2658c3ddc436adf2d7c4b660224c7acbb358cdab6e8a90333 |
| hovercard-subject-tag | issue:1511006698 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/100536/issue_layout |
| twitter:image | https://opengraph.githubassets.com/501f7feabfad08087088d23536781c857793c99a488e66d3a57fa7a7785a64f6/python/cpython/issues/100536 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/501f7feabfad08087088d23536781c857793c99a488e66d3a57fa7a7785a64f6/python/cpython/issues/100536 |
| og:image:alt | Crash report When PyFrame_GetBack is called during a sys.settrace hook in a C extension, it segfaults for some libraries(spacy) Following is a reproducer: https://gist.github.com/sumerc/b254f38c5a6... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sumerc |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0e60568924309a021b51adabdce15c2a2f285b556f3130d1a2fa2a5bce11c55f |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | dd206f7ed6207863172be4a783826e86bd2375c3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width