Skip to content

Memory leak on dask client and workers #2328

Closed

Description

@lanougue

Hi everyone,

EDIT : After looking into details, the client/scheduler seems to store some "informations" about the network status (and other stuff) after doing calculations. Doing client.map(...) ... client.gather() loops seems to slightly increase these data at each loop. In my configuration it ends blowing up my memory.
Doing a client.restart() resets this data and thus release the memory. However, restarting all workers can take some times (more than 5 minutes in my case) and is thus prohibitive.
Is there some way to wipe out the data stored by the client/scheduler without restarting the workers ?
Thanks

ORIGINAL MESSSAGE:

I suspect some memory leak in my simple code du to dask. My code structure looks like

from dask_jobqueue import PBSCluster
from distributed import Client
cluster = PBSCluster()
cluster.start_workers(Nworkers)
client = Client(cluster)

for i in range(N):
    res = []
    myjobs = client.map(myfunction, updated_args)
    res = client.gather(myjobs)
    write_on_the_disk(res)

After each for-loop, the memory usage of my process is larger, leading after some iterations to a memory crash. I verified that all my functions in the loop do not increase the memory usage (by writing the results on the disk).
I thus suspects that there is some informations stored by dask (maybe in the scheduler ?) at each for-loop that is not been freed at the end of the loop.
For my code, it represents 1GB at each loop wich "rapidly" makes my code crashing.
Is there some mean to freed this memory ?

(In the same spirit, the memory on each of my workers do not seem to be entirely freed after being gathered too)

Thanks for the help

Activity

  1. mrocklin commented on Nov 16, 2018

    @mrocklin
    Member

    (sorry for the delay in response)

    The diagnostic logs are bounded and tend not to contribute much to memory use (at least that's my experience). If you're able to find a particular cause of the memory leak that would be very welcome. There is no method to automatically clear out these logs.

  2. lanougue commented on Nov 16, 2018

    @lanougue
    Author

    Hi @mrocklin
    No problem for the delayed response and thanks. Since then, I have done some other tests. It looks like that my memory leaks are due to the HPC (I/O on the disk) and not related to dask/distributed. See issue.
    I updated all my libraries and redo the test. I wasn't able to release the memory even restarting/killing client and erasing all my variables.
    For now, I am not suspecting the scheduler anymore and will try soon my code on another HPC.
    Sorry for the noise. I will close the issue.

  3. jlevy44 commented on Jul 19, 2019

    @jlevy44

    @lanougue Why were there issues using PBS? I've been trying to start a client within a PBS submission script, but half of my jobs have been getting killed

  4. jlevy44 commented on Jul 19, 2019

    @jlevy44

    I'm not writing data to the disk through. That worked fine for me.

  5. lanougue commented on Jul 19, 2019

    @lanougue
    Author

    My problem is not PBS related. It is an I/O issue on some disk of our cluster.

  6. jlevy44 commented on Jul 19, 2019

    @jlevy44

    Oh okay.

    Do you know if it's possible to run a local cluster within a submitted PBS job?

  7. lanougue commented on Jul 19, 2019

    @lanougue
    Author

    On Ifremer cluster, running a LocalCluster never worked for me. But it works like a charm on my personnal laptop (without PBS).

  8. jlevy44 commented on Jul 19, 2019

    @jlevy44

    What would you recommend in this case then? I am trying to access a large array and compute on hundreds of thousands of smaller subarrays and store the results in a dask array, one row per subarray stats. I'd like to do this for a hundred large arrays, I thought I'd submit each of them as PBS jobs. @lanougue

  9. jlevy44 commented on Jul 19, 2019

    @jlevy44

    Each large array is submitted as a separate command.

  10. lanougue commented on Jul 19, 2019

    @lanougue
    Author

    This question is a different topic. You should post in another issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions