-
-
Notifications
You must be signed in to change notification settings - Fork 797
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
After execution complete, RDS connections staying open #798
Comments
hey @piedpieper which version of |
generally speaking, this plugin is not responsible for your code, it essentially just runs it. that being said, there might be some issues with certain patterns regarding db connections and pooling, e.g. I think I remember seeing some issues with like I said, it would be good to get to the root of this once and for all if you could provide some sample handler code - or just some pseudo code, I just need to know where and how you are opening your db connections. |
Version 5.10.1, no flags, node.js. Opening the SQL connection using knex:
|
thank you! one more question: are you running the above I forgot, in addition: does the pool deplete with just hitting the endpoint (without changing the handler file), or only when you change the handler file, hit the endpoint, change the file, hit the endpoint and so on? |
Im running it outside, in module scope. I import the connection into my handler. It depletes with just hitting the endpoint, without changing the handler file |
thanks @piedpieper I'll have a look and try to reproduce. in the meanwhile, could you try the latest |
I found the culprit, although I couldn't quite reproduce it completely because when hammering an endpoint, A LOT of connections have been established, BUT (in my case) also eventually being released. I also used for now, use Now, when I tried the same in v6 alpha, I also saw only 1 connection open. Reason is, that we are keeping the handler running now, similar to what Lambda does (and the cache invalidator is currently also not being used I believe, although I have to double check as v6 is still a work in progress). my plan is to remove could you let me know if |
@dnalborczyk --skipCacheInvalidation works for me ! |
I am running an RDS MySQL server on a t2.micro. This instance allows 65 concurrent connections. Running lambda functions using invoke local, or actually deploying them, the connections close immediately after running. Using sls-offline, they stay open. Each function invocation will open a new connection, and these connections are never closed.
Here is my RDS monitor - the large ramp ups are my uses of serverless ofline. The sharp drops are every time I stop serverless-offline with Ctrl-c. The relevant insight from this graph is that the # of connections never goes down until sls-offline is exited.
The text was updated successfully, but these errors were encountered: