dherault / serverless-offline

Emulate AWS λ and API Gateway locally when developing your Serverless project
MIT License
5.19k stars 796 forks source link

Lambda timeouts and memory consumption #1652

Open Mesourogiwi opened 1 year ago

Mesourogiwi commented 1 year ago

Hey there!

I'm running a project using microsservices with lerna to start them. The problem is that many of services are returning the error Lambda timeout. The workaround was increase the timeout limit (from 15 to 60), but the other problem i'm running into is the huge memory consumption, causing memory leaks:

image

image

Serverless-offline version: 12.0.4 Obs: This error occurs in both Windows and MacOS.

dnalborczyk commented 1 year ago

@Mesourogiwi it's hard to tell what's causing your problem when looking at some screenshots. Are you starting one serverless-offline instance or multiple? could you create a small repro repository we could look into ?

Mesourogiwi commented 1 year ago

Multiple instances, basically each microsservice instance one serverless-offline. I'll look forward to replicate this errors in another repo, but this one is private.

Btw, this project has 14 microsservices

lukemcgregor commented 1 year ago

Im having a similar problem. Im also using multiple instances of serverless-offline via lerna (but only 3), The error seems to occur randomly after sitting idle for some time. Again this started after upgrading to serverless-offline 12.0.4.

I get the Lambda timeout message on every request following this occurring.

The memory usage is quite high for me (around 600mb while requests are occurring) but it appears to be releasing the memory as it will drop to about half of this after a short idle.

When the actual timeout occurs I don't see it in conjunction with a memory spike. Im also not getting the EventEmitter leak error.

Im not sure if any of this helps but its at least some more data.