Update from 0.6.18 to 0.7.0 introduces a leak
Problem description
Today (17/03) a new version of google-gax has been released with an update of the grpc-js package from 0.6 to 0.7 as you can see here https://github.com/googleapis/gax-nodejs/releases. We use this package as a dependency of the NodeJS Bigtable client module. Since then we experienced multiple crashes of our containers (on Kubernetes) due to high resources usage. It turns out that by reverting grpc-js to 0.6.18 the following way in package.json everything comes back to normal :
{
"resolutions": {
"@grpc/grpc-js": "0.6.18"
}
}
and then :
npx npm-force-resolutions
npm i
Can you get a memory dump to see what is leaking?
Just FYI, google-gax v1.15.1 is out (pinning @grpc/grpc-js to ^0.6.18).
Oh great thanks for the rollback.
Do you still need the dump ? I am not sure if it's a memory or a CPU issue yet. I can also activate GRPC_VERBOSITY. Right now is the peak hour so I'll try tomorrow if you need it.
@apatora Yes, the dump will be very helpful. We rolled back just as a precaution.
I managed to reproduce the issue locally with a simple script :
const Bigtable = require('@google-cloud/bigtable')
const bigtable = new Bigtable({
projectId: '<projectId>',
})
const instance = bigtable.instance('<instance>')
;(async () => {
let iteration = 0
while (true) {
console.log(iteration)
const promises = []
for (let i = 0; i < 1000; i++) {
promises.push(
instance
.table('<table>')
.row('<test>')
.exists()
)
}
await Promise.all(promises)
iteration++
}
})()
With [email protected], it crashes after the ~47th iteration with an out of memory error whereas with [email protected] the memory stabilizes at ~250Mb.
I've published version 0.7.2, which appears to correct the leak in my own local testing. Would you mind trying it out?
Tried the 0.7.2 version and it works fine. Thanks!