Selenium in AWS Lambda Memory Leak?

I have a lambda function that is being called every 5-10 seconds.
It scrapes some web sites using selenium, chrome and chrome driver.
If the same instance of the lambda container is being called multiple times; I see the memory usage is being increased with each call.

I made sure driver.quit is being called on every usage.

But still the total memory usage increases.

I use docker image based lambda container and I have tried the same docker image on my local.
I have called it many times on local(inside same docker container as I am using in AWS) and there were no memory leak.

I have even tried forcing lambda to not use same container instances and initialize each time from scratch but could not find a proper way (except calling updatefunctioncode etc but i dont want this).

Any ideas please?

Source: Docker Questions

LEAVE A COMMENT