OpenImageIO icon indicating copy to clipboard operation
OpenImageIO copied to clipboard

[BUG] Segmentation Fault when Running Unit Tests using Python Wheel

Open KelSolaar opened this issue 6 months ago • 2 comments
trafficstars

Describe the bug

This is just to create an issue related to this very long thread on Slack: https://academysoftwarefdn.slack.com/archives/C05782U3806/p1743211403165799

There were multiple problems and @lgritz fixed one here: https://github.com/AcademySoftwareFoundation/OpenImageIO/pull/4685

I still however have issues with the Python wheels were occasionally, unit tests ran with Pytest and xdist are sometimes Segfaulting and/or hanging the test thread:

Windows fatal exception: access violation
Thread 0x00000da8 (most recent call first):
  File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\threading.py", line 331 in wait
  File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\threading.py", line 629 in wait
  File "D:\a\colour\colour\.venv\Lib\site-packages\tqdm\_monitor.py", line 60 in run
  File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\threading.py", line 1045 in _bootstrap_inner
  File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\threading.py", line 1002 in _bootstrap
Thread 0x000012dc (most recent call first):
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 534 in read
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 567 in from_io
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 1160 in _thread_receiver
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 341 in run
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 411 in _perform_spawn
Current thread 0x00000838 (most recent call first):
  File "D:\a\colour\colour\colour\io\image.py", line 702 in write_image_OpenImageIO
  File "D:\a\colour\colour\colour\io\tests\test_image.py", line 375 in test_write_image_OpenImageIO
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\python.py", line 159 in pytest_pyfunc_call
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_callers.py", line 103 in _multicall
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_manager.py", line 120 in _hookexec
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_hooks.py", line 513 in __call__
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\python.py", line 1627 in runtest
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\runner.py", line 174 in pytest_runtest_call
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_callers.py", line 103 in _multicall
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_manager.py", line 120 in _hookexec
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_hooks.py", line 513 in __call__
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\runner.py", line 242 in <lambda>
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\runner.py", line 341 in from_call
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\runner.py", line 241 in call_and_report
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\runner.py", line 132 in runtestprotocol
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\runner.py", line 113 in pytest_runtest_protocol
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_callers.py", line 103 in _multicall
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_manager.py", line 120 in _hookexec
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_hooks.py", line 513 in __call__
  File "D:\a\colour\colour\.venv\Lib\site-packages\xdist\remote.py", line 195 in run_one_test
  File "D:\a\colour\colour\.venv\Lib\site-packages\xdist\remote.py", line 174 in pytest_runtestloop
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_callers.py", line 103 in _multicall
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_manager.py", line 120 in _hookexec
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_hooks.py", line 513 in __call__
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\main.py", line 337 in _main
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\main.py", line 283 in wrap_session
  File "D:\a\colour\colour\.venv\Lib\site-packages\_pytest\main.py", line 330 in pytest_cmdline_main
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_callers.py", line 103 in _multicall
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_manager.py", line 120 in _hookexec
  File "D:\a\colour\colour\.venv\Lib\site-packages\pluggy\_hooks.py", line 513 in __call__
  File "D:\a\colour\colour\.venv\Lib\site-packages\xdist\remote.py", line 393 in <module>
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 1291 in executetask
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 341 in run
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 411 in _perform_spawn
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 389 in integrate_as_primary_thread
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 1273 in serve
  File "D:\a\colour\colour\.venv\Lib\site-packages\execnet\gateway_base.py", line 1806 in serve
  File "<string>", line 8 in <module>
  File "<string>", line 1 in <module>
.............................................[gw0] node down: Not properly terminated

OpenImageIO version and dependencies

Python Wheel 3.0.6.1: https://pypi.org/project/OpenImageIO/3.0.6.1/

To Reproduce

This one is hard to reproduce as it is not occurring all the time and only on Windows. However, now that I'm writing this, we had some unit tests that have been occasionally hanging on Ubuntu also which is where we were testing our code OIIO before using the Wheels. So maybe this has been going for a while and the error only surfaced on Windows.

Those logs have both issues on Windows and Ubuntu:

4_windows-latest - Python 3.12.txt 7_ubuntu-latest - Python 3.10.txt

KelSolaar avatar May 07 '25 10:05 KelSolaar