You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bigtable: potential memory leak from xDS runner goroutine when DirectPath is unavailable, introduced in v1.46.0 #14582
module modname
go 1.25.0
require (
cloud.google.com/go/bigtable v1.47.0
)
Expected behavior
Memory usage is stable, consistent with v1.43.0–v1.45.0 behavior
Actual behavior
Heap grows continuously after upgrading to v1.46.0. Heap profile shows (*adsStreamImpl).runner from google.golang.org/grpc@v1.80.0/internal/xds/clients/xdsclient/ads_stream.go accumulating memory. Which caused OOM in one of our pods.
Screenshots
Memory Usage Trends
Heap Live Size
Additional context
We are suspecting the bug is the unconditional DirectPath probe spawning xDS goroutines that can't clean up on non-DirectPath infrastructure.
The trigger is v1.46.0 enabling BigtableChannelPool by default, which exposed this to all users.
Our temporary workaround :
After setting CBT_ENABLE_DIRECTPATH=false, the memory usage returns to stable:
@mnjnwang to clarify, this is about the step increase in the overall memory utilisation when upgrading to 1.46.0 client, right?
I just want to make sure you are seeing the memory increase and stay constant but the constant memory accumulation through the lifetime of the pod.
It is not a stable step increase. We are seeing constant memory accumulation over the lifetime of the pod. It steadily climbs and looks likely a memory leak introduced in 1.46.0.
I believe we're seeing the same thing. We were using direct path at 1.44.0 via setting CBT_DIRECT_PATH=true with no obvious memory leak. We then accidentally disabled it. Yesterday we realised, upgraded to 1.48 where it is on by default (and I believe now uses a new bigtable connection pool by default too?). Today we see evidence of steady memory growth since the upgrade.
We use option.WithGRPCConnectionPool(6)
Note that in our case Direct Path is available. It certainly was working with 1.44, and CheckDirectAccessSupported still returns true.
edit: I should say the wavy nature of the line is probably because in this environment the only thing that's running is a bunch of system tests that run about once every 10 minutes
I'm trying CBT_ENABLE_DIRECTPATH=true & CBT_BIGTABLE_CONN_POOL=false. Memory usage looks flat, but it takes a while to accumulate so I'll try to remember to report back later.
Memory growth is definitely slower like this, and perhaps is rising slowly to a maximum (asymptotic). The graph starts on 1.44 without direct path, the middle section is 1.48, the final section is 1.48 with CBT_ENABLE_DIRECTPATH=true & CBT_BIGTABLE_CONN_POOL=false
@philpearl thanks for the pprof. i am trying to run the tests with CBT_ENABLE_CONN_POOL=true and false and see if i can repro the memory leak on my side. thanks.
Thanks @sushanb! I've got 1.49.0 running with a couple of services in our staging environment. It all looks good so far, but I'll check again tomorrow to give it a chance to leak.
I have put the code into production for a couple of services, but I do think we're still seeing a slight rise in memory over time that we didn't see before. I'll see if I can get some data on what's happening, but it's slight enough that I'm not 100% that it's a leak. I think it would be reasonable to count this as fixed!
@philpearl we just released a bigtable client with bidi support in 1.52.0 (instead per rpc, we used a long lived bidi stream and use that for sending and receiving requests). This should provide even better performance in both p50 and p99.
It is gated (basically the 1.52.0 client routes every method via original path). Would you be interested in trying and seeing the performance in staging environment? If so, we could enable the new session path for your staging instances.
@sushanb yes, that would be very interesting. I'll get us rolled up to 1.52.0 (I think we're currently on 1.51)
I should let you know that we think we are still seeing a memory leak, perhaps only in lower-volume services and environments. We're still trying to characterise it.
To avoid PII leaking here, could you send me the instance and app profile for staging in sushanb@google.com?
There will be a incremental memory stepup (cost of 10 grpc channels), in our benchmark it showed around addition of 400 goroutines and 15MB of memory. For this client, we ran multiple tests for our long lived bidi client and there is no memory leak.
I should let you know that we think we are still seeing a memory leak, perhaps only in lower-volume services and environments. We're still trying to characterise it.
-please let me know if you characterise it.
Activity
bhshkh commentedon May 15, 2026
Reassigning to @sushanb who works on the data client.
sushanb commentedon May 19, 2026
@mnjnwang to clarify, this is about the step increase in the overall memory utilisation when upgrading to 1.46.0 client, right?
I just want to make sure you are seeing the memory increase and stay constant but the constant memory accumulation through the lifetime of the pod.
mnjnwang commentedon May 20, 2026
It is not a stable step increase. We are seeing constant memory accumulation over the lifetime of the pod. It steadily climbs and looks likely a memory leak introduced in 1.46.0.
sushanb commentedon May 20, 2026
Thanks. We are looking into it.
One more question, do you set the connection pool size or use the default one?
mnjnwang commentedon May 20, 2026
@sushanb Yes we set the pool size to 2 by adding
option.WithGRPCConnectionPool(2))in the opts during client initialization.philpearl commentedon Jun 3, 2026
I believe we're seeing the same thing. We were using direct path at 1.44.0 via setting CBT_DIRECT_PATH=true with no obvious memory leak. We then accidentally disabled it. Yesterday we realised, upgraded to 1.48 where it is on by default (and I believe now uses a new bigtable connection pool by default too?). Today we see evidence of steady memory growth since the upgrade.
We use
option.WithGRPCConnectionPool(6)Note that in our case Direct Path is available. It certainly was working with 1.44, and CheckDirectAccessSupported still returns true.
edit: I should say the wavy nature of the line is probably because in this environment the only thing that's running is a bunch of system tests that run about once every 10 minutes
philpearl commentedon Jun 3, 2026
The leak appears to be related to XDS endpoints
Inuse-object counts perhaps points to XDS endpoint updates getting left in the unbounded buffer? It's not at all clear why that might happen.
philpearl commentedon Jun 3, 2026
I'm trying CBT_ENABLE_DIRECTPATH=true & CBT_BIGTABLE_CONN_POOL=false. Memory usage looks flat, but it takes a while to accumulate so I'll try to remember to report back later.
philpearl commentedon Jun 4, 2026
Memory growth is definitely slower like this, and perhaps is rising slowly to a maximum (asymptotic). The graph starts on 1.44 without direct path, the middle section is 1.48, the final section is 1.48 with CBT_ENABLE_DIRECTPATH=true & CBT_BIGTABLE_CONN_POOL=false
philpearl commentedon Jun 4, 2026
I let the original leak run overnight. This is with the default 1.48 behaviour, not disabling the new conn pool.
sushanb commentedon Jun 10, 2026
@philpearl thanks for the pprof. i am trying to run the tests with CBT_ENABLE_CONN_POOL=true and false and see if i can repro the memory leak on my side. thanks.
sushanb commentedon Jun 10, 2026
We have a mitigation by disabling the connection recycler. the bug seems to be in the xds library so what we can do is
fix(bigtable): raise default connection-recycler MaxAge to 7 days (#1…
sushanb commentedon Jun 10, 2026
i also disabled dynamic channel pool to be safe(it does not cause bloat compared to regular connection recycling). #19945.
For workaround in the affected version, 1.46.0, 1.47.0 and 1.48.0, customers can set
configs.DisableConnectionRecycler = truegoogle-cloud-go/bigtable/client.go
Line 76 in a7959ef
sushanb commentedon Jun 10, 2026
Updated known issue in
https://github.com/googleapis/google-cloud-go/releases/tag/bigtable%2Fv1.46.0
https://github.com/googleapis/google-cloud-go/releases/tag/bigtable%2Fv1.47.0
https://github.com/googleapis/google-cloud-go/releases/tag/bigtable%2Fv1.48.0
fix(bigtable): disable dynamic channel pool by default and raise defa…
sushanb commentedon Jun 10, 2026
@mnjnwang @philpearl bigtable: v1.49.0 Latest this should remove the memory leak with direct access.
Please give it a try without any flags and let us know if you encounter any issue.
philpearl commentedon Jun 11, 2026
Thanks @sushanb! I've got 1.49.0 running with a couple of services in our staging environment. It all looks good so far, but I'll check again tomorrow to give it a chance to leak.
sushanb commentedon Jun 12, 2026
any updates @philpearl
philpearl commentedon Jun 15, 2026
I have put the code into production for a couple of services, but I do think we're still seeing a slight rise in memory over time that we didn't see before. I'll see if I can get some data on what's happening, but it's slight enough that I'm not 100% that it's a leak. I think it would be reasonable to count this as fixed!
docs: add example 1-hour run with pprof bookends
sushanb commentedon Aug 4, 2026
@philpearl we just released a bigtable client with bidi support in 1.52.0 (instead per rpc, we used a long lived bidi stream and use that for sending and receiving requests). This should provide even better performance in both p50 and p99.
It is gated (basically the 1.52.0 client routes every method via original path). Would you be interested in trying and seeing the performance in staging environment? If so, we could enable the new session path for your staging instances.
philpearl commentedon Aug 5, 2026
@sushanb yes, that would be very interesting. I'll get us rolled up to 1.52.0 (I think we're currently on 1.51)
I should let you know that we think we are still seeing a memory leak, perhaps only in lower-volume services and environments. We're still trying to characterise it.
sushanb commentedon Aug 5, 2026
To avoid PII leaking here, could you send me the instance and app profile for staging in sushanb@google.com?
There will be a incremental memory stepup (cost of 10 grpc channels), in our benchmark it showed around addition of 400 goroutines and 15MB of memory. For this client, we ran multiple tests for our long lived bidi client and there is no memory leak.
I should let you know that we think we are still seeing a memory leak, perhaps only in lower-volume services and environments. We're still trying to characterise it.
-please let me know if you characterise it.
xds/cdsbalancer/e2e_test: drop cc.Connect and issue link per review