-
Notifications
You must be signed in to change notification settings - Fork 111
Possible memory leak #1409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @sergii-mamedov @lmacielvieira After extensive testing of Lithops, I’ve identified the following findings: The The After several experiments running Line 318 in c4ecc74
For the tests I used the To improve this, I created this PR (#1414) with fixes that will substantially reduce the number of threads, so that the number of threads in the async invokers will depend on your configuration. I also verified that in the rest of the components of the code where we create threads, they are properly closed. |
Thank you very much for your research. |
Hi @JosepSampe,
I think I found two memory leaks in lithops:
FaaSInvoker and self.executor
You create a ThreadPoolExecutor
lithops/lithops/invokers.py
Line 305 in c4ecc74
and use it here
lithops/lithops/invokers.py
Line 456 in c4ecc74
but you don't do
self.executor.shutdown()
so the threads remain hanging.In our case, the worker using lithops is a daemon. This means that for each new dataset for AWS Lambda, we create 64 new threads because we are reusing an existing
Serverless Executor
. This leads to hundreds of hanging threads after a couple of hours .FaaSInvoker and _start_async_invokers
This is much less of a problem, but also creates two threads each time
lithops/lithops/invokers.py
Lines 332 to 336 in c4ecc74
Yes, there is a
stop()
method below but it automatically works only forclass FaaSRemoteInvoker
. In case I callexecutor = lithops.ServerlessExecutor(config=lithops_config, ...)
then thestop()
method only works in the case of a context manager:lithops/lithops/executors.py
Lines 159 to 163 in fdb6432
I'm not insisting that there is a memory leak here, but even in the documentation there are many examples where
FunctionExecutor
is used withoutwith
.P.S. Now the main developer of METASPACE is @lmacielvieira, so I'm tagging him as well @Bisho2122
The text was updated successfully, but these errors were encountered: