René's URL Explorer Experiment


Title: segmentation fault in PyContextVar_set under py3.9 ARM64 · Issue #122529 · python/cpython · GitHub

Open Graph Title: segmentation fault in PyContextVar_set under py3.9 ARM64 · Issue #122529 · python/cpython

X Title: segmentation fault in PyContextVar_set under py3.9 ARM64 · Issue #122529 · python/cpython

Description: Bug report Bug description: A segmentation fault sometimes occurs in an application using Datadog's ddtrace-run 2.9.0, CPython 3.9, and sqlalchemy on ARM64. Our (@sanchda and my) analysis suggests that this is the result of a bug in CPyt...

Open Graph Description: Bug report Bug description: A segmentation fault sometimes occurs in an application using Datadog's ddtrace-run 2.9.0, CPython 3.9, and sqlalchemy on ARM64. Our (@sanchda and my) analysis suggests ...

X Description: Bug report Bug description: A segmentation fault sometimes occurs in an application using Datadog's ddtrace-run 2.9.0, CPython 3.9, and sqlalchemy on ARM64. Our (@sanchda and my) analysis sugge...

Opengraph URL: https://github.com/python/cpython/issues/122529

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"segmentation fault in PyContextVar_set under py3.9 ARM64","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\nA segmentation fault sometimes occurs in an application using Datadog's ``ddtrace-run`` 2.9.0, CPython 3.9, and sqlalchemy on ARM64. Our (@sanchda and my) analysis suggests that this is the result of a bug in CPython 3.9, which may have been fixed in CPython 3.12. We are unable to replicate this issue directly because it happens sporadically on infrastructure operated by a Datadog customer.\r\n\r\nOne instance of the segfault for which we managed to capture a core dump looks like this:\r\n\r\n```\r\nCurrent thread 0x0000ffff9a4915a0 (most recent call first):,1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/ddtrace/_trace/provider.py\"\", line 126 in activate\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/ddtrace/_trace/tracer.py\"\", line 807 in _start_span\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/ddtrace/_trace/tracer.py\"\", line 898 in trace\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/ddtrace/contrib/dbapi/__init__.py\"\", line 311 in _trace_method\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/ddtrace/contrib/dbapi/__init__.py\"\", line 335 in rollback\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py\"\", line 683 in do_rollback\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py\"\", line 1038 in _reset\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py\"\", line 763 in _finalize_fairy\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py\"\", line 1008 in _checkin\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/pool/base.py\"\", line 1166 in close\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py\"\", line 1251 in close\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py\"\", line 928 in close\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py\"\", line 846 in commit\",1719935856047\r\n\"File \"\"/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py\"\", line 1454 in commit\",1719935856047\r\n# application stack frames....\r\n```\r\n\r\nThe leaf node of this Python stacktrace is [this call](https://github.com/DataDog/dd-trace-py/blob/1e4ecf948e3a12b82ca6307f7bbcf52ceedad074/ddtrace/_trace/provider.py#L126) to `contextvars.ContextVar().set()`, which operates on a contextvar instance internal to Datadog code that's initialized [here](https://github.com/DataDog/dd-trace-py/blob/1e4ecf948e3a12b82ca6307f7bbcf52ceedad074/ddtrace/_trace/provider.py#L17-L19).\r\n\r\nThe core dump also includes this native backtrace:\r\n\r\n```\r\n*** Segmentation fault,1719935856047\r\nBacktrace:,1719935856047\r\n/lib/aarch64-linux-gnu/libc.so.6(+0x80a10)[0xffff99fb0a10],1719935856048\r\n/lib/aarch64-linux-gnu/libc.so.6(gsignal+0x1c)[0xffff99f6a76c],1719935856048\r\nlinux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffff9a49d850],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xd2538)[0xffff9a1b2538],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xd2ce0)[0xffff9a1b2ce0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xd3414)[0xffff9a1b3414],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xcd82c)[0xffff9a1ad82c],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(PyContextVar_Set+0x10c)[0xffff9a1add0c],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x13a4c8)[0xffff9a21a4c8],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x1540)[0xffff9a24ae20],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x1540)[0xffff9a24ae20],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137eec)[0xffff9a217eec],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x1be8)[0xffff9a24b4c8],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x3134)[0xffff9a24ca14],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x3134)[0xffff9a24ca14],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x1540)[0xffff9a24ae20],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x3134)[0xffff9a24ca14],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x3134)[0xffff9a24ca14],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x137df0)[0xffff9a217df0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x1540)[0xffff9a24ae20],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x6d4)[0xffff9a249fb4],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x3134)[0xffff9a24ca14],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyFunction_Vectorcall+0xb0)[0xffff9a215bd0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x135da0)[0xffff9a215da0],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalFrameDefault+0x548)[0xffff9a249e28],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x168c24)[0xffff9a248c24],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(_PyEval_EvalCodeWithName+0x64)[0xffff9a2aeb74],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(PyEval_EvalCodeEx+0x40)[0xffff9a2aeb00],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(PyEval_EvalCode+0x2c)[0xffff9a2aeaac],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x1e08fc)[0xffff9a2c08fc],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x1e0868)[0xffff9a2c0868],1719935856049\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0x1e0798)[0xffff9a2c0798],1719935856050\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(PyRun_SimpleFileExFlags+0x190)[0xffff9a2c03e4],1719935856050\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(Py_RunMain+0x3c4)[0xffff9a2c9624],1719935856050\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(Py_BytesMain+0x38)[0xffff9a2c9078],1719935856050\r\n/lib/aarch64-linux-gnu/libc.so.6(+0x27780)[0xffff99f57780],1719935856050\r\n/lib/aarch64-linux-gnu/libc.so.6(__libc_start_main+0x98)[0xffff99f57858],1719935856050\r\n/usr/local/bin/python3(_start+0x30)[0xaaaaad2308b0],1719935856050\r\n```\r\n\r\nThese lines in particular warrant scrutiny:\r\n\r\n```\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xd2538)[0xffff9a1b2538],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xd2ce0)[0xffff9a1b2ce0],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xd3414)[0xffff9a1b3414],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(+0xcd82c)[0xffff9a1ad82c],1719935856048\r\n/usr/local/bin/../lib/libpython3.9.so.1.0(PyContextVar_Set+0x10c)[0xffff9a1add0c],1719935856048\r\n```\r\n\r\nWe grabbed the `libpython3.9.so.1.0` from Dockerhub's ``python:3.9.19-bookworm, (arm64)`` image, version ``sha256:37823bd8e7266bac0399e3b55e67cfe00297686f09fe5cf73411ffe1d75fd93e``. This .so file is bitwise-identical to the artifact used in the production environment that the core dump came from.\r\n\r\nWe used `objdump` to symbolize the containing functions within `libpython3.9.so.1.0` and found the following:\r\n\r\n```\r\n0xd2538 -\u003e hamt_node_bitmap_clone\r\n0xd2ce0 -\u003e hamt_node_bitmap_assoc\r\n0xd3414 -\u003e _PyHamt_Assoc\r\n0xcd82c -\u003e contextvar_set\r\n0x10c   -\u003e PyContextVar_set\r\n```\r\n\r\nThe leaf of this call stack is defined in Py3.9 [here](https://github.com/python/cpython/blob/06fa244666ec6335a3b9bf2367e31b42b9a89b20/Python/hamt.c#L589).\r\n\r\n`ghidra` gives us the following decompilation of the `hamt_node_bitmap_clone` function:\r\n\r\n```\r\nvoid hamt_node_bitmap_clone(long param_1)\r\n\r\n{\r\n  long lVar1;\r\n  long lVar2;\r\n  long *plVar3;\r\n  long lVar4;\r\n\r\n  lVar1 = hamt_node_bitmap_new(*(undefined8 *)(param_1 + 0x10));\r\n  if (lVar1 != 0) {\r\n    lVar4 = *(long *)(param_1 + 0x10);\r\n    for (lVar2 = 0; lVar2 \u003c lVar4; lVar2 = lVar2 + 1) {\r\n      plVar3 = *(long **)(param_1 + 0x20 + lVar2 * 8);                     // 0xd2530\r\n      if (plVar3 != (long *)0x0) {\r\n        *plVar3 = *plVar3 + 1;\r\n      }\r\n      *(long **)(lVar1 + 0x20 + lVar2 * 8) = plVar3;\r\n    }\r\n    *(undefined4 *)(lVar1 + 0x18) = *(undefined4 *)(param_1 + 0x18);\r\n  }\r\n  return;\r\n}\r\n```\r\n\r\n`objdump` tells us that the specific fault site is `0xd2538`, which ghidra tells us is on the line\r\n\r\n```\r\nplVar3 = *(long **)(param_1 + 0x20 + lVar2 * 8);\r\n```\r\n\r\nThe source code counterpart of this decompiled line is [here](https://github.com/python/cpython/blob/06fa244666ec6335a3b9bf2367e31b42b9a89b20/Python/hamt.c#L602), a call to `Py_XINCREF`.\r\n\r\n`ghidra` gives the failing instructions from this line as\r\n\r\n```\r\n001d2530 a2 78 61 f8     ldr        x2,[x5, x1, LSL #0x3]\r\n001d2534 82 00 00 b4     cbz        x2,LAB_001d2544\r\n001d2538 43 00 40 f9     ldr        x3,[x2]               # this is the site of the fault\r\n001d253c 63 04 00 91     add        x3,x3,#0x1\r\n```\r\n\r\n* `ldr`: load the given value into the register x2.\r\n* `cbz`: conditional jump if zero.  This is looking at x2 as a value, not as a pointer.\r\n    It’s probably part of ``Py_XINCREF`` where it checks non-null. Since the next instruction is executed, x2 is NOT null.\r\n* `ldr`: de-references x2 and puts it in x3. x2 is not NULL (we know that because the computation on the ldr line is an iteration)\r\n    So, x2 is an invalid address\r\n* `add`: this is just the increment operation from the ``Py_XINCREF``\r\n\r\nIn terms of the source code, this suggests that `node-\u003eb_array[i]` is an invalid nonzero pointer [here](https://github.com/python/cpython/blob/06fa244666ec6335a3b9bf2367e31b42b9a89b20/Python/hamt.c#L602).\r\n\r\nSome speculative reasons why this could happen:\r\n\r\n1. The given item was cleaned up and is no longer valid, although sometimes it is valid because it is freed but not unmapped\r\n    This might explain why the problem occurs on arm but not x86, since the mapping behavior at the level of the allocator may just so happen to be different for system reasons\r\n2. The size of the array is incorrect\r\n3. The item is uninitialized\r\n\r\nIn this case, the \"item\" is a HAMT node underlying a `ContextVar` instance being `set()` during a sqlalchemy rollback operation.\r\n\r\nAside from this analysis, another reason we're opening this issue on CPython is that the `Py_XINCREF` line in question was changed since Python 3.9. #99317 replaced it with a call to `Py_XNewRef` [here](https://github.com/python/cpython/pull/99317/files#diff-57efcedae5cd47def53e512cf0bae5554f794563c3c6269b3a9ac3fa24055001R578). While we haven't tested this against Python 3.12 (the first to include the change), the presence of this change suggests that a bug may have been fixed in newer versions that could be worth backporting. Even without a backport, confirmation that this is or was a real issue in CPython itself would be helpful.\r\n\r\n### CPython versions tested on:\r\n\r\n3.9\r\n\r\n### Operating systems tested on:\r\n\r\nLinux","author":{"url":"https://github.com/emmettbutler","@type":"Person","name":"emmettbutler"},"datePublished":"2024-07-31T18:07:58.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":9},"url":"https://github.com/122529/cpython/issues/122529"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:27cd6f0b-da90-0bb3-5109-456a413460d0
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8CDA:E3A3B:FAFB2F:1505324:6969926E
html-safe-noncede900622fa5d0a7950912712e07bf931d7fe9a4b931e80287bccea4739efa3ac
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4Q0RBOkUzQTNCOkZBRkIyRjoxNTA1MzI0OjY5Njk5MjZFIiwidmlzaXRvcl9pZCI6IjE2MDAwMTU3ODA4NzU4NDM2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9e2504ad9e5ecdd94fcc3d3e8eabccc0c16795d9d3bde3760c355b41eb779d3d
hovercard-subject-tagissue:2440621891
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/122529/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f4ce0a4e02fa2af8b404b9101881f9c83ff0fa3fbe564ececfaf710cc2840749/python/cpython/issues/122529
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f4ce0a4e02fa2af8b404b9101881f9c83ff0fa3fbe564ececfaf710cc2840749/python/cpython/issues/122529
og:image:altBug report Bug description: A segmentation fault sometimes occurs in an application using Datadog's ddtrace-run 2.9.0, CPython 3.9, and sqlalchemy on ARM64. Our (@sanchda and my) analysis suggests ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameemmettbutler
hostnamegithub.com
expected-hostnamegithub.com
None3542e147982176a7ebaa23dfb559c8af16f721c03ec560c68c56b64a0f35e751
turbo-cache-controlno-preview
go-importgithub.com/python/cpython git https://github.com/python/cpython.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id81598961
octolytics-dimension-repository_nwopython/cpython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id81598961
octolytics-dimension-repository_network_root_nwopython/cpython
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseaf80af7cc9e3de9c336f18b208a600950a3c187c
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/cpython/issues/122529#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F122529
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fcpython%2Fissues%2F122529
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Fcpython
Reloadhttps://github.com/python/cpython/issues/122529
Reloadhttps://github.com/python/cpython/issues/122529
Reloadhttps://github.com/python/cpython/issues/122529
python https://github.com/python
cpythonhttps://github.com/python/cpython
Please reload this pagehttps://github.com/python/cpython/issues/122529
Notifications https://github.com/login?return_to=%2Fpython%2Fcpython
Fork 33.9k https://github.com/login?return_to=%2Fpython%2Fcpython
Star 71.1k https://github.com/login?return_to=%2Fpython%2Fcpython
Code https://github.com/python/cpython
Issues 5k+ https://github.com/python/cpython/issues
Pull requests 2.1k https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects 31 https://github.com/python/cpython/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/python/cpython/security
Please reload this pagehttps://github.com/python/cpython/issues/122529
Insights https://github.com/python/cpython/pulse
Code https://github.com/python/cpython
Issues https://github.com/python/cpython/issues
Pull requests https://github.com/python/cpython/pulls
Actions https://github.com/python/cpython/actions
Projects https://github.com/python/cpython/projects
Security https://github.com/python/cpython/security
Insights https://github.com/python/cpython/pulse
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/122529
New issuehttps://github.com/login?return_to=https://github.com/python/cpython/issues/122529
segmentation fault in PyContextVar_set under py3.9 ARM64https://github.com/python/cpython/issues/122529#top
3.9 (EOL)end of lifehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.9%20(EOL)%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com/emmettbutler
https://github.com/emmettbutler
emmettbutlerhttps://github.com/emmettbutler
on Jul 31, 2024https://github.com/python/cpython/issues/122529#issue-2440621891
@sanchdahttps://github.com/sanchda
this callhttps://github.com/DataDog/dd-trace-py/blob/1e4ecf948e3a12b82ca6307f7bbcf52ceedad074/ddtrace/_trace/provider.py#L126
herehttps://github.com/DataDog/dd-trace-py/blob/1e4ecf948e3a12b82ca6307f7bbcf52ceedad074/ddtrace/_trace/provider.py#L17-L19
herehttps://github.com/python/cpython/blob/06fa244666ec6335a3b9bf2367e31b42b9a89b20/Python/hamt.c#L589
herehttps://github.com/python/cpython/blob/06fa244666ec6335a3b9bf2367e31b42b9a89b20/Python/hamt.c#L602
herehttps://github.com/python/cpython/blob/06fa244666ec6335a3b9bf2367e31b42b9a89b20/Python/hamt.c#L602
#99317https://github.com/python/cpython/pull/99317
herehttps://github.com/python/cpython/pull/99317/files#diff-57efcedae5cd47def53e512cf0bae5554f794563c3c6269b3a9ac3fa24055001R578
3.9 (EOL)end of lifehttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%223.9%20(EOL)%22
type-crashA hard crash of the interpreter, possibly with a core dumphttps://github.com/python/cpython/issues?q=state%3Aopen%20label%3A%22type-crash%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.