dask / dask/distributed

`test_secede_rejoin_busy` flaky

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

Description

We observed `distributed/tests/test_threadpoolexecutor.py::test_secede_rejoin_busy` fail over in https://github.com/dask/distributed/pull/5260 (see [this CI build](https://github.com/dask/distributed/pull/5260/checks?check_run_id=3435016243))

```python
___________________________ test_secede_rejoin_busy ____________________________

def test_secede_rejoin_busy():
with ThreadPoolExecutor(2) as e:
# Prime threads
f1 = e.submit(sleep, 0.1)
f2 = e.submit(sleep, 0.1)
f1.result()
f2.result()

def f():
assert threading.current_thread() in e._threads
secede()
sleep(0.2)
assert threading.current_thread() not in e._threads
rejoin()
assert len(e._threads) == 2
assert threading.current_thread() in e._threads
return threading.current_thread()

future = e.submit(f)
for _ in range(6):
e.submit(sleep, 0.4)
start = time()
special_thread = future.result()
stop = time()

assert 0.2 < stop - start < 0.6

assert len(e._threads) == 2
assert special_thread in e._threads

def f():
sleep(0.01)
return threading.current_thread()

futures = [e.submit(f) for _ in range(10)]
> assert special_thread in {future.result() for future in futures}
E assert in {}
```

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.