Memory leak with Client object
- Dominant language
- Python
- Stars
- 1.7k
- Forks
- 778
- Avg merge
- 2h 50m
- Merged PRs (30d)
- 3
Description
For some reason when I try to close and delete a `Client` object that uses a `LocalCluster`, I still see that it exists in memory even after `gc.collect()`. Am I correctly cleaning up the client object?
```python
import gc
import platform
import sys
import weakref
import dask
import distributed
import tornado
from distributed import LocalCluster, Client
def main():
cluster = LocalCluster(
diagnostics_port=None,
ip='127.0.0.1',
n_workers=1,
scheduler_port=0,
threads_per_worker=1,
)
client = Client(
address=cluster,
)
wr = weakref.ref(client)
client.close()
del client
gc.collect()
assert wr() is None
if __name__ == '__main__':
print('OS:', platform.platform())
print('Python Version:', sys.version)
print('Dask Version:', dask.__version__)
print('Distributed Version:', distributed.__version__)
print('Tornado Version:', tornado.version)
main()
```
#### Output
```
OS: Windows-7-6.1.7601-SP1
Python Version: 3.5.6 |Anaconda, Inc.| (default, Aug 26 2018, 16:05:27) [MSC v.1900 64 bit (AMD64)]
Dask Version: 1.0.0
Distributed Version: 1.25.2
Tornado Version: 5.1.1
distributed.comm.tcp - WARNING - Closing dangling stream in
Traceback (most recent call last):
File "", line 34, in
main()
File "", line 26, in main
assert wr() is None
AssertionError
Process finished with exit code 1
```
Contributor guide
Assessment
This issue has not been assessed yet.