Title: JIT: Segmentation fault in _Py_LazyJitTrampoline when running test_asyncio after gh-139269 fix · Issue #139288 · python/cpython · GitHub
Open Graph Title: JIT: Segmentation fault in _Py_LazyJitTrampoline when running test_asyncio after gh-139269 fix · Issue #139288 · python/cpython
X Title: JIT: Segmentation fault in _Py_LazyJitTrampoline when running test_asyncio after gh-139269 fix · Issue #139288 · python/cpython
Description: Bug report Bug description: Description: A segmentation fault occurs when running the test_asyncio test suite on a debug build with JIT, ASAN, and UBSAN enabled. This issue was observed on the main branch after incorporating the fix from...
Open Graph Description: Bug report Bug description: Description: A segmentation fault occurs when running the test_asyncio test suite on a debug build with JIT, ASAN, and UBSAN enabled. This issue was observed on the main...
X Description: Bug report Bug description: Description: A segmentation fault occurs when running the test_asyncio test suite on a debug build with JIT, ASAN, and UBSAN enabled. This issue was observed on the main...
Opengraph URL: https://github.com/python/cpython/issues/139288
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"JIT: Segmentation fault in _Py_LazyJitTrampoline when running test_asyncio after gh-139269 fix","articleBody":"# Bug report\n\n### Bug description:\n\n### **Description:**\n\nA segmentation fault occurs when running the `test_asyncio` test suite on a debug build with JIT, ASAN, and UBSAN enabled.\n\nThis issue was observed on the `main` branch after incorporating the fix from PR 139271, which addressed issue `gh-139269` (unaligned memory access in JIT code patching functions). This suggests a potential regression or a new issue introduced by that fix.\n\n**Build Configuration:**\n* CPython Version: `3.15.0a0 (heads/gh-139269-dirty:2c1339b2a5)`\n* Build Type: `debug JIT ASAN+UBSAN`\n* System: `Linux-6.14.0-32-generic-x86_64-with-glibc2.41`\n* Compiler: `Clang 20.1.2`\n\n**Steps to Reproduce:**\n1. Build CPython from the specified commit on the `main` branch with debug, JIT, ASAN, and UBSAN enabled. [jit_fixed.sh](https://github.com/user-attachments/files/22510549/jit_fixed.sh)\n2. Run the asyncio test suite: `./python -m test test_asyncio` \n\n**Observed Behavior:**\nThe test runner starts, attempts to run the first test (`test.test_asyncio.test_base_events`), and immediately crashes with a `Fatal Python error: Segmentation fault`.\n\n**Analysis:**\nThe attached logs provide detailed information, but the key findings are:\n\n1. **GDB Analysis:** GDB confirms the crash occurs precisely at `Python/jit.c:626` inside the `_Py_LazyJitTrampoline` function, at the line that calls `_Py_jit_entry`. This indicates the fault happens at the exact moment the interpreter attempts to transfer control to JIT-compiled code.\n\n2. **AddressSanitizer (ASAN) Report:** The ASAN log reports a `SEGV on unknown address 0x0000000580ba` caused by a `READ` memory access. The C stack trace also points to `_Py_LazyJitTrampoline` as the immediate cause of the fault.\n\n3. **Python Stack Trace:** The Python-level stack trace shows that the interpreter is deep within the `unittest.mock` and `inspect` modules during the setup for `test_base_events`. The crash is triggered during a call chain that includes `inspect._shadowed_dict` -> `inspect._check_class` -> `inspect.getattr_static`, which is initiated by the `Mock` object's initialization.\n\nThe issue seems to be a corruption of state or a bad pointer being used by the JIT trampoline (`_Py_LazyJitTrampoline`). Given that this appeared after the fix for unaligned memory access, it is possible that the changes in PR 139271 have inadvertently affected pointer calculation or state setup prior to calling `_Py_jit_entry`, leading to this segmentation fault under the specific code paths exercised by `test_asyncio` and `unittest.mock`.\n\n**Logs:**\n\n[gdb_logs.txt](https://github.com/user-attachments/files/22510628/gdb_logs.txt)\n[test_logs.txt](https://github.com/user-attachments/files/22510629/test_logs.txt)\n\n### CPython versions tested on:\n\nCPython main branch\n\n### Operating systems tested on:\n\nLinux","author":{"url":"https://github.com/ashm-dev","@type":"Person","name":"ashm-dev"},"datePublished":"2025-09-24T09:35:56Z","url":"https://github.com/python/cpython/issues/139288"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:fc01627d-41c6-ea2a-28fd-6ba47b4e626b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C8FC:27E5CD:4E8EB1E:6414C11:6B0265FD |
| html-safe-nonce | 4791610c566c5466e7ed6af2f09e5203cbfd6b61d2cfb1f92fbbf2b1ec5b840c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEZDOjI3RTVDRDo0RThFQjFFOjY0MTRDMTE6NkIwMjY1RkQiLCJ2aXNpdG9yX2lkIjoiMzU3Njk4MDU2MTI3MDU2NDM0OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | bb0c7d959cefb36b145d6791fe2b089d154c630697fd7ebf9312036566a00b62 |
| hovercard-subject-tag | issue:3448566289 |
| 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/139288/issue_layout |
| twitter:image | https://opengraph.githubassets.com/41a7b522a8616739d6abf2cf966b6802afc902f46aa3e57cf73fad062c9fc234/python/cpython/issues/139288 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/41a7b522a8616739d6abf2cf966b6802afc902f46aa3e57cf73fad062c9fc234/python/cpython/issues/139288 |
| og:image:alt | Bug report Bug description: Description: A segmentation fault occurs when running the test_asyncio test suite on a debug build with JIT, ASAN, and UBSAN enabled. This issue was observed on the main... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ashm-dev |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width