Like I said before, my lambda is running out of me...
# help
a
Like I said before, my lambda is running out of memory… apparently I have a memory leak, once the function instance is UP (after a cold start) it starts to consume more and more memory. How is supposed that I can debug this kind of issues? that’s my problem with Lambda.. I don’t see an official way to debug or profile this. 😞 On this screenshot, you can see, from bottom to top, that my lambda starts to consume more and more memory on each request… after it reaches 512MB and crashes (that’s my limit).
r
It's unlikely to be a lambda specific thing which means you should be able reproduce running the function outside the lambda environment. The first thing I'd look at is how you're caching things outside of your handler, these are the things that will be kept around between invocations.
j
I do agree that it’s annoying to debug these. There should be better tooling for this. What would be the ideal way to deal with issues like this?
r
a
@Jay we need a sort of profiler, I’m looking into v8-profiler and others, but there is nothing plug and play. Definitely a gap here were the community should create something.
@Ross Coundon yeah definitely have some variables on the global scope, like DB connection and others. But still hard to know why those are keep increasing size.
@Ross Coundon thanks for the link, going to check those.
j
@Adrián Mouly agreed. Let me just put this on @Frank’s radar as well.
a
Great guys, you both are so awesome.
f
@Jay does it make sense if
sst start
had a flag to run with a built-in profiler on?
j
Oh, that’s a pretty interesting idea.
a
@Jay yeah we need this! move it to high priority. 😂
f
a
😍