Skip to content

Commit e1c24f7

Browse files
committed
[DO NOT MERGE] Confirm py3.15 segfault is a CPython alpha ABI skew
faulthandler showed the cp315 segfault is inside 'import torch' (initModule -> CPython PyObject_SetAttr/_PyObject_MakeTpCall), i.e. an ABI mismatch between the 3.15 alpha torch was built against and the conda-forge python=3.15.0a8 runtime this job installs. Replace the (unavailable in manylinux) gdb probe with a cross-interpreter check: import the same libtorch_python.so under both the conda-forge python and the manylinux python.org /opt/python/cp315-cp315 interpreter. If it crashes under conda-forge but loads under manylinux, the conda-forge alpha is confirmed as the culprit. Revert before merging.
1 parent e406613 commit e1c24f7

1 file changed

Lines changed: 26 additions & 19 deletions

File tree

.github/workflows/build_wheels_linux.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -278,36 +278,43 @@ jobs:
278278
279279
# --- DEBUG (Python 3.15 segfault in `setup.py clean`): remove before merge ---
280280
# On cp315 `python setup.py clean` dies with SIGSEGV (exit 139, core
281-
# dumped). setup.py imports torch, so the crash is almost certainly in
282-
# `import torch` from the cp315 nightly wheel. Capture where it happens
283-
# with a Python faulthandler traceback and a native gdb backtrace.
284-
# All debug commands are non-fatal (`|| true`) so they never mask the
285-
# real failure below.
281+
# dumped). faulthandler showed the crash is inside `import torch`
282+
# (torch/__init__.py:445 -> initModule in libtorch_python.so), in
283+
# CPython's own PyObject_SetAttr / _PyObject_MakeTpCall machinery --
284+
# the signature of a C-API/ABI skew between the 3.15 *alpha* the torch
285+
# wheel was compiled against and the runtime interpreter.
286+
#
287+
# The torch cp315 nightly wheel is built with the manylinux python.org
288+
# interpreter (/opt/python/cp315-cp315), but this job runs under
289+
# conda-forge python=3.15.0a8. Import the same torch .so under BOTH
290+
# interpreters: if it crashes under conda-forge but loads under the
291+
# manylinux python, the conda-forge alpha is the culprit (3.15's ABI is
292+
# not frozen until beta). All debug commands are non-fatal (`|| true`)
293+
# so they never mask the real failure below.
286294
echo "::group::DEBUG: interpreter / torch wheel info"
287295
${CONDA_RUN} python -VV || true
288296
${CONDA_RUN} python -c "import sysconfig; print('Py_GIL_DISABLED:', sysconfig.get_config_var('Py_GIL_DISABLED'))" || true
297+
/opt/python/cp315-cp315/bin/python -VV || true
289298
${CONDA_RUN} pip show torch || true
290299
echo "::endgroup::"
291300
292-
echo "::group::DEBUG: import torch under faulthandler"
301+
echo "::group::DEBUG: import torch under conda-forge python (faulthandler)"
293302
# faulthandler dumps the Python stack at the moment of the fatal signal.
294303
${CONDA_RUN} python -X faulthandler -c "import torch; print('torch', torch.__version__, 'imported OK')" \
295-
|| echo "DEBUG: 'import torch' crashed (see faulthandler traceback above)"
304+
|| echo "DEBUG: 'import torch' crashed under conda-forge python (see faulthandler traceback above)"
296305
echo "::endgroup::"
297306
298-
echo "::group::DEBUG: native backtrace via gdb"
299-
# Allow core dumps and run the failing command under gdb for a C-level backtrace.
300-
ulimit -c unlimited || true
301-
command -v gdb >/dev/null 2>&1 || yum install -y gdb >/dev/null 2>&1 || true
302-
if command -v gdb >/dev/null 2>&1; then
303-
${CONDA_RUN} gdb -q -batch \
304-
-ex "set pagination off" \
305-
-ex "run" \
306-
-ex "bt full" \
307-
-ex "thread apply all bt" \
308-
--args python -X faulthandler setup.py clean || true
307+
echo "::group::DEBUG: import same torch .so under manylinux python.org cp315"
308+
# Point the manylinux interpreter at the conda env's site-packages so it
309+
# loads the identical libtorch_python.so, isolating interpreter ABI from
310+
# the torch build itself.
311+
TORCH_SITE_PACKAGES="$(${CONDA_RUN} python -c 'import site; print(site.getsitepackages()[0])' 2>/dev/null || true)"
312+
if [ -x /opt/python/cp315-cp315/bin/python ] && [ -n "${TORCH_SITE_PACKAGES}" ]; then
313+
PYTHONPATH="${TORCH_SITE_PACKAGES}" /opt/python/cp315-cp315/bin/python -X faulthandler \
314+
-c "import torch; print('torch', torch.__version__, 'imported OK under manylinux python.org cp315')" \
315+
|| echo "DEBUG: import also crashed under manylinux python.org cp315 -> NOT a conda-forge-only ABI skew"
309316
else
310-
echo "DEBUG: gdb unavailable; skipping native backtrace"
317+
echo "DEBUG: manylinux cp315 interpreter or torch site-packages not found; skipping cross-interpreter probe"
311318
fi
312319
echo "::endgroup::"
313320
# --- END DEBUG ---

0 commit comments

Comments
 (0)