boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
21 stars 10 forks source link

`TestSave` hangs with python 3.13 #304

Open ZedThree opened 3 weeks ago

ZedThree commented 3 weeks ago

Some kind of issue with threading on python 3.13. test_save_all hangs and needs to be killed. Traceback from killing it:

python -m pytest -vv -k TestSave
============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.13.0, pytest-8.3.3, pluggy-1.5.0 -- /home/peter/Codes/BOUT++/xBOUT/.venv/bin/python
cachedir: .pytest_cache
rootdir: /home/peter/Codes/BOUT++/xBOUT
configfile: pyproject.toml
plugins: cov-6.0.0
collecting ... 
    skipping long tests, pass '--long' to enable
collected 798 items / 779 deselected / 19 selected                                                                                                                                                               

xbout/tests/test_boutdataset.py::TestSave::test_save_all ^C

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/threading.py:359: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
============================================================================================ 779 deselected in 12.78s ============================================================================================
^CException ignored on threading shutdown:
Traceback (most recent call last):
  File "/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/threading.py", line 1534, in _shutdown
    atexit_call()
  File "/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/threading.py", line 1505, in <lambda>
    _threading_atexits.append(lambda: func(*arg, **kwargs))
  File "/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/concurrent/futures/thread.py", line 31, in _python_exit
    t.join()
  File "/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/threading.py", line 1092, in join
    self._handle.join(timeout)
KeyboardInterrupt: 
^CException ignored in atexit callback <bound method ThreadPoolExecutor.shutdown of <concurrent.futures.thread.ThreadPoolExecutor object at 0x7f87ebc8f8c0>>:
Traceback (most recent call last):
  File "/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/concurrent/futures/thread.py", line 238, in shutdown
    t.join()
  File "/home/peter/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu/lib/python3.13/threading.py", line 1092, in join
    self._handle.join(timeout)
KeyboardInterrupt: 

I couldn't see any obvious issues on xarray or dask about this, and I couldn't immediately reproduce it manually (i.e. not in pytest)