dask / dask/distributed

Sporadic crashing related to temp-directory on Windows

Open
#7,594 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

**Describe the issue**:

Running a minimal dask workflow on Windows on github actions causes sporadic (~25% of the time) crashes. From the error messages it seems like there is a problem with the tmp-directory or the logging or both combined. The workflow is just a function returning a value.

Pointers to what I could test to debug this are very welcome.

**Error output**:

```
--- Logging error ---
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\shutil.py", line 600, in _rmtree_unsafe
with os.scandir(path) as scandir_it:
^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp1m_2ria9\\dask-worker-space\\worker-scwm44lh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\logging\__init__.py", line 1113, in emit
stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\weakref.py", line 666, in _exitfunc
f()
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\weakref.py", line 590, in __call__
return info.func(*info.args, **(info.kwargs or {}))
File "D:\a\pharmpy\pharmpy\.tox\unit\Lib\site-packages\distributed\diskutils.py", line 103, in _finalize
workspace._purge_directory(dir_path)
File "D:\a\pharmpy\pharmpy\.tox\unit\Lib\site-packages\distributed\diskutils.py", line 218, in _purge_directory
shutil.rmtree(dir_path, onerror=self._on_remove_error)
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\shutil.py", line 603, in _rmtree_unsafe
onerror(os.scandir, path, sys.exc_info())
File "D:\a\pharmpy\pharmpy\.tox\unit\Lib\site-packages\distributed\diskutils.py", line 252, in _on_remove_error
logger.error("Failed to remove %r (failed in %r): %s", path, func, str(exc))
Message: 'Failed to remove %r (failed in %r): %s'
Arguments: ('C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp1m_2ria9\\dask-worker-space\\worker-scwm44lh', , "[WinError 3] The system cannot find the path specified: 'C:\\\\Users\\\\RUNNER~1\\\\AppData\\\\Local\\\\Temp\\\\tmp1m_2ria9\\\\dask-worker-space\\\\worker-scwm44lh'")
--- Logging error ---
Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\shutil.py", line 624, in _rmtree_unsafe
os.rmdir(path)
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp1m_2ria9\\dask-worker-space\\worker-scwm44lh'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\logging\__init__.py", line 1113, in emit
stream.write(msg + self.terminator)
ValueError: I/O operation on closed file.
Call stack:
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\weakref.py", line 666, in _exitfunc
f()
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\weakref.py", line 590, in __call__
return info.func(*info.args, **(info.kwargs or {}))
File "D:\a\pharmpy\pharmpy\.tox\unit\Lib\site-packages\distributed\diskutils.py", line 103, in _finalize
workspace._purge_directory(dir_path)
File "D:\a\pharmpy\pharmpy\.tox\unit\Lib\site-packages\distributed\diskutils.py", line 218, in _purge_directory
shutil.rmtree(dir_path, onerror=self._on_remove_error)
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\shutil.py", line 759, in rmtree
return _rmtree_unsafe(path, onerror)
File "C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\shutil.py", line 626, in _rmtree_unsafe
onerror(os.rmdir, path, sys.exc_info())
File "D:\a\pharmpy\pharmpy\.tox\unit\Lib\site-packages\distributed\diskutils.py", line 252, in _on_remove_error
logger.error("Failed to remove %r (failed in %r): %s", path, func, str(exc))
Message: 'Failed to remove %r (failed in %r): %s'
Arguments: ('C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\tmp1m_2ria9\\dask-worker-space\\worker-scwm44lh', , "[WinError 2] The system cannot find the file specified: 'C:\\\\Users\\\\RUNNER~1\\\\AppData\\\\Local\\\\Temp\\\\tmp1m_2ria9\\\\dask-worker-space\\\\worker-scwm44lh'")
[gw1] [100%] PASSED tests/workflows/test_execute.py::test_execute_workflow_results_with_report

================================== FAILURES ===================================
____________________________ test_local_dispatcher ____________________________
[gw1] win32 -- Python 3.11.2 D:\a\pharmpy\pharmpy\.tox\unit\Scripts\python.EXE
tests\workflows\test_dispatchers.py:6: in test_local_dispatcher
res = local_dask.run(wf)
.tox\unit\Lib\site-packages\pharmpy\workflows\dispatchers\local_dask.py:76: in run
with LocalCluster(
.tox\unit\Lib\site-packages\distributed\deploy\local.py:253: in __init__
super().__init__(
.tox\unit\Lib\site-packages\distributed\deploy\spec.py:288: in __init__
self.sync(self._correct_state)
.tox\unit\Lib\site-packages\distributed\utils.py:338: in sync
return sync(
.tox\unit\Lib\site-packages\distributed\utils.py:405: in sync
raise exc.with_traceback(tb)
.tox\unit\Lib\site-packages\distributed\utils.py:378: in f
result = yield future
.tox\unit\Lib\site-packages\tornado\gen.py:762: in run
value = future.result()
.tox\unit\Lib\site-packages\distributed\deploy\spec.py:369: in _correct_state_internal
worker = cls(
.tox\unit\Lib\site-packages\distributed\worker.py:607: in __init__
with warn_on_duration(
C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\contextlib.py:144: in __exit__
next(self.gen)
.tox\unit\Lib\site-packages\distributed\utils.py:1232: in warn_on_duration
warnings.warn(msg.format(duration=diff), stacklevel=2)
E UserWarning: Creating scratch directories is taking a surprisingly long time. (1.82s) This is often due to running workers on a network file system. Consider specifying a local-directory to point workers to write scratch data to a local disk.
------------------------------ Captured log call ------------------------------
INFO distributed.scheduler:scheduler.py:1615 State start
INFO distributed.scheduler:scheduler.py:3861 Scheduler at: inproc://10.1.0.97/1184/9
INFO distributed.scheduler:scheduler.py:3863 dashboard at: localhost:60721
WARNING asyncio:base_events.py:1917 Executing exception=UserWarning('Creating scratch directories is taking a surprisingly long time. (1.82s) This is often due to running workers on a network file system. Consider specifying a local-directory to point workers to write scratch data to a local disk.') created at C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\asyncio\tasks.py:670> took 1.828 seconds
INFO distributed.scheduler:scheduler.py:3926 Scheduler closing...
INFO distributed.scheduler:scheduler.py:3948 Scheduler closing all comms
______________________ test_execute_workflow_map_reduce _______________________
[gw0] win32 -- Python 3.11.2 D:\a\pharmpy\pharmpy\.tox\unit\Scripts\python.EXE
tests\workflows\test_execute.py:64: in test_execute_workflow_map_reduce
res = execute_workflow(wf)
.tox\unit\Lib\site-packages\pharmpy\workflows\execute.py:69: in execute_workflow
res: T = dispatcher.run(workflow)
.tox\unit\Lib\site-packages\pharmpy\workflows\dispatchers\local_dask.py:76: in run
with LocalCluster(
.tox\unit\Lib\site-packages\distributed\deploy\local.py:253: in __init__
super().__init__(
.tox\unit\Lib\site-packages\distributed\deploy\spec.py:288: in __init__
self.sync(self._correct_state)
.tox\unit\Lib\site-packages\distributed\utils.py:338: in sync
return sync(
.tox\unit\Lib\site-packages\distributed\utils.py:405: in sync
raise exc.with_traceback(tb)
.tox\unit\Lib\site-packages\distributed\utils.py:378: in f
result = yield future
.tox\unit\Lib\site-packages\tornado\gen.py:762: in run
value = future.result()
.tox\unit\Lib\site-packages\distributed\deploy\spec.py:369: in _correct_state_internal
worker = cls(
.tox\unit\Lib\site-packages\distributed\worker.py:607: in __init__
with warn_on_duration(
C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\contextlib.py:144: in __exit__
next(self.gen)
.tox\unit\Lib\site-packages\distributed\utils.py:1232: in warn_on_duration
warnings.warn(msg.format(duration=diff), stacklevel=2)
E UserWarning: Creating scratch directories is taking a surprisingly long time. (1.88s) This is often due to running workers on a network file system. Consider specifying a local-directory to point workers to write scratch data to a local disk.
------------------------------ Captured log call ------------------------------
INFO distributed.scheduler:scheduler.py:1615 State start
INFO distributed.scheduler:scheduler.py:3861 Scheduler at: inproc://10.1.0.97/5664/74
INFO distributed.scheduler:scheduler.py:3863 dashboard at: localhost:31058
WARNING asyncio:base_events.py:1917 Executing exception=UserWarning('Creating scratch directories is taking a surprisingly long time. (1.88s) This is often due to running workers on a network file system. Consider specifying a local-directory to point workers to write scratch data to a local disk.') created at C:\hostedtoolcache\windows\Python\3.11.2\x64\Lib\asyncio\tasks.py:670> took 1.875 seconds
INFO distributed.scheduler:scheduler.py:3926 Scheduler closing...
INFO distributed.scheduler:scheduler.py:3948 Scheduler closing all comms
=========================== short test summary info ===========================
SKIPPED [6] tests\internals\fs\test_lock.py:151: TODO Processes-based tests randomly fail on Windows.
SKIPPED [9] tests\internals\fs\test_lock.py:97: TODO Processes-based tests randomly fail on Windows.
SKIPPED [1] tests\internals\fs\test_lock.py:189: TODO Processes-based tests randomly fail on Windows.
SKIPPED [1] tests\internals\fs\test_lock.py:291: TODO Processes-based tests randomly fail on Windows.
SKIPPED [1] tests\internals\fs\test_lock.py:325: TODO Processes-based tests randomly fail on Windows.
SKIPPED [1] tests\internals\fs\test_lock.py:364: TODO Processes-based tests randomly fail on Windows.
SKIPPED [1] tests\internals\fs\test_lock.py:436: TODO Processes-based tests randomly fail on Windows.
SKIPPED [1] tests\modeling\test_common.py:46: D:\a\pharmpy\pharmpy\tests\testdata\nonmem\minimal.mod is not a descendant of home directory (C:\Users\runneradmin)
SKIPPED [1] tests\tools\test_ml.py:16: Skipping tests requiring tflite for Python 3.10
SKIPPED [1] tests\tools\test_ml.py:24: Skipping tests requiring tflite for Python 3.10
SKIPPED [1] tests\tools\test_summarize_individuals.py:44: Skipping tests requiring tflite for Python 3.10
FAILED tests/workflows/test_dispatchers.py::test_local_dispatcher - UserWarning: Creating scratch directories is taking a surprisingly long time. (1.82s) This is often due to running workers on a network file system. Consider specifying a local-directory to point workers to write scratch data to a local disk.
FAILED tests/workflows/test_execute.py::test_execute_workflow_map_reduce - UserWarning: Creating scratch directories is taking a surprisingly long time. (1.88s) This is often due to running workers on a network file system. Consider specifying a local-directory to point workers to write scratch data to a local disk.
```

**Environment**:

- Dask version: 2023.2.1
- Python version: Python 3.11
- Operating System: Windows (GHA)
- Install method (conda, pip, source): pip

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.