-
Notifications
You must be signed in to change notification settings - Fork 232
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
Memory leak when connection dropped on emulator #574
Comments
It sounds like we would have to add some sort of throttling to stop this behavior. That sounds like a feature request to me. |
It looks like there is also some sort of multiplier total bytes used per message, as per this other issue. |
I'm also seeing this error when running the emulator. I occasionally see a warning indicating a memory leak as well.
|
The emulator connection was never retried, and the RPCs were constantly retried on the broken connection without any back-off. That caused the event loop to not move to the next phase, since it was stuck on constantly trying to resolve the failed promise, and then retrying. @ajaaym will add a link to an article about this problem. This should have been fixed in the |
@ThomWright and @nmiddendorff, can you please upgrade to the latest version of the client? That should fix the problem. @bcoe, I found this issue to be fascinating. I'd appreciate your perspective on this topic. |
I'm closing this. If this is still a problem, please open up a new issue. |
@sduskis agreed, this bug was nasty and interesting. I'm not shocked shocked that grpc retrying in an unbounded way, without actually scheduling any IO, could saturate resources ... adding a back-off seems like the right solution 😄 In practice, my experience at npm was that we rarely had to dig quite so deeply into the nitty-gritty of the event loop except when debugging edge-cases like this; as an example, the route that served package meta-information handled many hundreds of concurrent requests at any given time, serving them in sub-50ms time, and I don't remember bumping into an issue like this. Sounds like what was probably happening in this case was that async tasks were being scheduled pretty much as fast as CPU could toss them on a stack? |
If my service has created a subscription, when it loses the connection to pubsub then CPU spikes to >100%, and within ~10 seconds the memory increases from ~100M to >1G and Node.js runs out of memory.
I see this when I'm my service is connected to the pubsub emulator locally in my Docker environment, and I stop the pubsub emulator container.
I create a subscription like so:
await topic.subscription(subscriptionName).get({autoCreate: true})
Environment details
mhart/alpine-node:11
)@google-cloud/pubsub
version: 0.28.1Steps to reproduce
Thanks!
The text was updated successfully, but these errors were encountered: