-
Notifications
You must be signed in to change notification settings - Fork 204
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
getting Possible EventEmitter memory leak detected on firebase functions that use google-cloud/ packages #1578
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Hey @jdziek. Could you provide a code sample and logs in text so that I can investigate this further? |
Hi,. thanks for replying. The code is above. I think you don't even need to run it, I get this warning whenever a function/container starts. The above is a simple backup, scheduler function, for our database. The message pops up in any function that references firebase/gcp packages, functions related in particular in particular. Chose this function as a sample as it had the least amount of code and thought it was the easiest to reproduce. Also, been trying the root of this problem in other repos so I thought it might be worth sharing this link
EDIT. Sorry, just realised that originally I posted a log of Honeybadgers report regarding the issue instead of the actual log relevant to the issue. Any help would be greatly appreciated. The thing keeps popping up still |
Hey @jdziek. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically. If you have more information that will help us get to the bottom of this, just add a comment! |
Writing is as i dont want this issue to close as I'm still experiencing the problem. I updated my previous post with a correct log this time. If my code sample is not sufficient, tell me how to improve it. It will be useful for the future issues. It was just the smallest/the easiest function to recreate I could find at the time. |
This error appears due to a hard coded default value for event listeners. See https://stackoverflow.com/questions/9768444/possible-eventemitter-memory-leak-detected for more details. This value can be increased but it's not recommended. Just to confirm, this error happens on large Firestore operations? It's what I assume from your code sample you had provided |
I saw that option and yeah, im quite reluctant to do it. Happens even in a small scale operation . The warning pops up as soon as the container starts that has code referencing gcp or firebase packages that reference @google-cloud/functions-framework in any way. The code doesn't even have to run. |
Could you give me a sample code I could run directly? I cannot seem to reproduce this issue but maybe I'm not doing the correct things to reproduce. A code sample I can copy and paste would really help :) |
Ah, sorry now i understand what you meant by the proper code sample. Sadly I'm struggling to recreate it and while I was doing so I started debugging it again. Thing I realised is that it has to do with how code between onRequest functions is interacting. Struggling to identify which ones those are as they seem to alternate I think depending on combination of which are enabled or not, making it incredibly frustrating.
in oRequest functions that also use express and express router. If I get any more info ill post an update. EDIT. Crap, I know why this is happening. Its the number of these process.on listeners. I had exactly 9 functions, only one of them had two on listeners (example above), so when I added another function with just
that made it eleven. Damn. Im sorry if I wasted your time. I guess that's another example that functions are not as independent as they seem at first, even within their own container. Also, now I know what you mean by a code sample. Mine was too tied to our codebase. Will bear that in mind in the future. |
No worries :) Don't let this discourage you from opening issues in the future. I'll close this issue now. Thanks for raising it anyways |
Hi.
I started getting a memory leak warning a few days ago for no apparent reason. I did update packages a few weeks ago but didn't see anything till recently. I updated the packages to the most recent ones again and still got that message.
This warning pops up whenever a function is initiated.
This is a copy of an issue I originally raised in nodejs-firestore repo but realised that this might be more related to functions, after reading the logs
Is this a client library issue or a product issue?
I believe this is a google-cloud package issue. I get this error, particularly in functions that must process files to storage.
Did someone already solve this?
I've seen it has been an issue in the past but nothing has been raised since then on a current release
Environment details
It happens on gen 2 firebase functions using [email protected] using nodejs 20
OtherGCPp packages that I'm using are
"@google-cloud/documentai": "^8.8.0",
"@google-cloud/firestore": "^7.8.0",
"@google-cloud/pubsub": "^4.5.0",
"@google-cloud/storage": "^7.11.2",
"firebase-admin": "^12.1.1",
"firebase-functions": "^5.0.1",
Here is a snippet of my code. The issue happens in every function that references google-cloud packages, so its not an isolated issue to this particular code, but I thought that it cant hurt including it.
The text was updated successfully, but these errors were encountered: