dask / dask/distributed

if `await worker.close()` fails - subsequent `await close()` calls hang forever

Open
#6,279 1 comment 1 reaction 0 assignees View on GitHub
bug core
Dominant language
Python
Stars
1.7k
Forks
778
Avg merge
2h 50m
Merged PRs (30d)
3

Description

```python
from distributed.diagnostics.plugin import WorkerPlugin
from distributed.core import Server

@gen_test()
async def test_close_after_failure():
class Crashed(Exception):
pass

class CrashPlugin(WorkerPlugin):
async def teardown(self, *args, **kwargs):
raise Crashed

async def register_worker(comm, *args, **kwargs):
try:
await comm.write({"status": "OK", "time": 0, "worker-plugins": {}})
await comm.read()
finally:
await comm.close()

async with Server(handlers={"register-worker": register_worker}) as s:
await s.listen("inproc://")
async with Worker(s.address, plugins=(CrashPlugin(),)) as w:
with pytest.raises(Crashed):
await w.close()

with pytest.raises(Crashed):
await w.close() # hangs
```

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.