open2c/bioframe

Two tests segfault on s390x

Closed this issue · 3 comments

While updating bioframe for Fedora to 0.7.1, I noticed two tests, test_read_sam and test_read_bam, segfaulting when run on s390x builders.

Previously with version 0.6.4 all tests succeeded. It looks like the change introduced in 660ba3f might be the cause. But I haven't analyzed this further.

Output for test_read_sam
tests/test_fileops.py::test_read_sam Fatal Python error: Segmentation fault
Current thread 0x000003ffbc4f7740 (most recent call first):
  File "/builddir/build/BUILD/python-bioframe-0.7.1-build/BUILDROOT/usr/lib/python3.13/site-packages/bioframe/io/fileops.py", line 255 in read_alignment
  File "/builddir/build/BUILD/python-bioframe-0.7.1-build/bioframe-0.7.1/tests/test_fileops.py", line 60 in test_read_sam
  File "/usr/lib/python3.13/site-packages/_pytest/python.py", line 194 in pytest_pyfunc_call
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/python.py", line 1792 in runtest
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 169 in pytest_runtest_call
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 262 in <lambda>
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 341 in from_call
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 261 in call_runtest_hook
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 222 in call_and_report
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 133 in runtestprotocol
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 114 in pytest_runtest_protocol
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 350 in pytest_runtestloop
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 325 in _main
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 271 in wrap_session
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 318 in pytest_cmdline_main
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/config/__init__.py", line 169 in main
  File "/usr/lib/python3.13/site-packages/_pytest/config/__init__.py", line 192 in console_main
  File "/usr/bin/pytest", line 8 in <module>
Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, pandas._libs.tslibs.ccalendar, pandas._libs.tslibs.np_datetime, pandas._libs.tslibs.dtypes, pandas._libs.tslibs.base, pandas._libs.tslibs.nattype, pandas._libs.tslibs.timezones, pandas._libs.tslibs.fields, pandas._libs.tslibs.timedeltas, pandas._libs.tslibs.tzconversion, pandas._libs.tslibs.timestamps, pandas._libs.properties, pandas._libs.tslibs.offsets, pandas._libs.tslibs.strptime, pandas._libs.tslibs.parsing, pandas._libs.tslibs.conversion, pandas._libs.tslibs.period, pandas._libs.tslibs.vectorized, pandas._libs.ops_dispatch, pandas._libs.missing, pandas._libs.hashtable, pandas._libs.algos, pandas._libs.interval, pandas._libs.lib, pandas._libs.ops, pandas._libs.hashing, pandas._libs.arrays, pandas._libs.tslib, pandas._libs.sparse, pandas._libs.internals, pandas._libs.indexing, pandas._libs.index, pandas._libs.writers, pandas._libs.join, pandas._libs.window.aggregations, pandas._libs.window.indexers, pandas._libs.reshape, pandas._libs.groupby, pandas._libs.json, pandas._libs.parsers, pandas._libs.testing, yaml._yaml, bbi.cbbi, PIL._imaging, kiwisolver._cext, pysam.libcutils, pysam.libchtslib, pysam.libcsamtools, pysam.libcbcftools, pysam.libcfaidx, pysam.libctabixproxies, pysam.libctabix, pysam.libcalignmentfile, pysam.libcalignedsegment, pysam.libcsamfile, pysam.libcvcf, pysam.libcbcf, pysam.libcbgzf (total: 70)
Output for test_read_bam
tests/test_fileops.py::test_read_bam Fatal Python error: Segmentation fault
Current thread 0x000003ffa8977740 (most recent call first):
  File "/builddir/build/BUILD/python-bioframe-0.7.1-build/BUILDROOT/usr/lib/python3.13/site-packages/bioframe/io/fileops.py", line 255 in read_alignment
  File "/builddir/build/BUILD/python-bioframe-0.7.1-build/bioframe-0.7.1/tests/test_fileops.py", line 66 in test_read_bam
  File "/usr/lib/python3.13/site-packages/_pytest/python.py", line 194 in pytest_pyfunc_call
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/python.py", line 1792 in runtest
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 169 in pytest_runtest_call
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 262 in <lambda>
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 341 in from_call
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 261 in call_runtest_hook
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 222 in call_and_report
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 133 in runtestprotocol
  File "/usr/lib/python3.13/site-packages/_pytest/runner.py", line 114 in pytest_runtest_protocol
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 350 in pytest_runtestloop
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 325 in _main
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 271 in wrap_session
  File "/usr/lib/python3.13/site-packages/_pytest/main.py", line 318 in pytest_cmdline_main
  File "/usr/lib/python3.13/site-packages/pluggy/_callers.py", line 77 in _multicall
  File "/usr/lib/python3.13/site-packages/pluggy/_manager.py", line 115 in _hookexec
  File "/usr/lib/python3.13/site-packages/pluggy/_hooks.py", line 493 in __call__
  File "/usr/lib/python3.13/site-packages/_pytest/config/__init__.py", line 169 in main
  File "/usr/lib/python3.13/site-packages/_pytest/config/__init__.py", line 192 in console_main
  File "/usr/bin/pytest", line 8 in <module>
Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, pandas._libs.tslibs.ccalendar, pandas._libs.tslibs.np_datetime, pandas._libs.tslibs.dtypes, pandas._libs.tslibs.base, pandas._libs.tslibs.nattype, pandas._libs.tslibs.timezones, pandas._libs.tslibs.fields, pandas._libs.tslibs.timedeltas, pandas._libs.tslibs.tzconversion, pandas._libs.tslibs.timestamps, pandas._libs.properties, pandas._libs.tslibs.offsets, pandas._libs.tslibs.strptime, pandas._libs.tslibs.parsing, pandas._libs.tslibs.conversion, pandas._libs.tslibs.period, pandas._libs.tslibs.vectorized, pandas._libs.ops_dispatch, pandas._libs.missing, pandas._libs.hashtable, pandas._libs.algos, pandas._libs.interval, pandas._libs.lib, pandas._libs.ops, pandas._libs.hashing, pandas._libs.arrays, pandas._libs.tslib, pandas._libs.sparse, pandas._libs.internals, pandas._libs.indexing, pandas._libs.index, pandas._libs.writers, pandas._libs.join, pandas._libs.window.aggregations, pandas._libs.window.indexers, pandas._libs.reshape, pandas._libs.groupby, pandas._libs.json, pandas._libs.parsers, pandas._libs.testing, yaml._yaml, bbi.cbbi, PIL._imaging, kiwisolver._cext, pysam.libcutils, pysam.libchtslib, pysam.libcsamtools, pysam.libcbcftools, pysam.libcfaidx, pysam.libctabixproxies, pysam.libctabix, pysam.libcalignmentfile, pysam.libcalignedsegment, pysam.libcsamfile, pysam.libcvcf, pysam.libcbcf, pysam.libcbgzf (total: 70)

Thank you for reporting this!

The offending extension module seems to be pysam (bindings for htslib), which is used to read the file. I just built pysam and tried reading the test file on a s390x docker container and I get the same segfault when reading a specific structured field in the first record. Probably an endianness issue.

pysam is an optional dependency and we are planning to replace it with a different library in the future. For now, we could explicitly forbid those functions or skip the tests on either s390x or big endian architectures. Would that work for you?

Thanks for digging into this. Excluding the failing tests is what we currently do downstream. So, yes, that will work until pysam has been replaced.

Tests should pass on s390x now.