CHORE: skip subprocess shutdown/teardown tests under QEMU and fix detection#673
Draft
bewithgaurav wants to merge 1 commit into
Draft
CHORE: skip subprocess shutdown/teardown tests under QEMU and fix detection#673bewithgaurav wants to merge 1 commit into
bewithgaurav wants to merge 1 commit into
Conversation
…ection the subprocess shutdown/teardown tests in test_013 and test_024 intermittently segfault on the qemu-emulated linux arm64 CI legs and force reruns. the crash is a latent use-after-free in odbc handle-teardown ordering (an unclosed DBC handle finalized by gc at interpreter shutdown after the process-lifetime ENV handle is gone, so SQLFreeHandle touches freed ENV memory). it is benign on native hardware and only turns fatal under qemu's page reuse plus altered gc timing, so it is a flaky heisenbug. is_qemu_emulated() was effectively dead: it only matched 'CPU implementer 0x51', which never appears under multiarch/qemu-user-static because the emulated aarch64 process sees the x86_64 host's /proc/cpuinfo. fix it to flag an aarch64 process when cpuinfo advertises implementer 0x51 (qemu-system) or lacks the arm-only 'CPU implementer' field entirely (qemu-user host passthrough). native arm64 and x86 stay unflagged. extend the existing skip to test_024's TestContextManagerCommit (all 24 cases run the subprocess-teardown path); test_013 already had the marker, and the detection fix makes it take effect. the underlying teardown-order uaf is tracked separately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
📊 Code Coverage Report
Diff CoverageDiff: main...HEAD, staged and unstaged changesNo lines with coverage information in this diff. 📋 Files Needing Attention📉 Files with overall lowest coverage (click to expand)mssql_python.pybind.logger_bridge.cpp: 59.2%
mssql_python.pybind.ddbc_bindings.h: 59.9%
mssql_python.pybind.logger_bridge.hpp: 70.8%
mssql_python.pybind.connection.connection.cpp: 76.2%
mssql_python.pybind.ddbc_bindings.cpp: 76.2%
mssql_python.__init__.py: 77.3%
mssql_python.row.py: 77.6%
mssql_python.ddbc_bindings.py: 79.6%
mssql_python.connection.py: 83.6%
mssql_python.logging.py: 85.5%🔗 Quick Links
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item / Issue Reference
Summary
the subprocess shutdown/teardown tests in
test_013_SqlHandle_free_shutdownandtest_024_context_manager_transactionintermittently segfault on the qemu-emulated linux arm64 CI legs and force reruns. the crash is a latent use-after-free in odbc handle-teardown ordering (an unclosed DBC handle finalized by gc at interpreter shutdown after the process-lifetime ENV handle is gone, soSQLFreeHandletouches freed ENV memory); it is benign on native hardware and only turns fatal under qemu's page reuse plus altered gc timing, which is why it is flaky and clears on rerun.test-only, two changes:
is_qemu_emulated()inconftest.py. the old check only matchedCPU implementer 0x51, which never appears undermultiarch/qemu-user-static(the emulated aarch64 process sees the x86_64 host's/proc/cpuinfo, which has no arm implementer field). it now flags an aarch64 process when cpuinfo advertises implementer0x51(qemu-system) or lacks the arm-onlyCPU implementerfield entirely (qemu-user host passthrough); native arm64 and x86 stay unflagged. the existingtest_013skip was dead because of this and now takes effect.skipif(QEMU)totest_024'sTestContextManagerCommit(all 24 cases run the subprocess-teardown path).the conftest docstring documents the underlying teardown-order uaf as the known-failure case. that root-cause bug is tracked separately and is unaffected by this skip; native legs still run these tests, so a regression there is not masked.