Open Champ-Goblem opened 1 year ago
I double checked that the version of bytes
that contains the fix is in fact being used by the proxy version in stable-2.12.4
, and it appears to be. Looking at the tag for stable-2.12.4
, we see that this release is on proxy version v2.188.0
, and when we look at the proxy's lockfile on the tag for v2.188.0
, we do see that the bytes
dependency is on v1.2.1
. So, the proxy in use here should have that fix.
I'd be interested to know whether this issue persists after updating to the latest stable (v2.13.x
), as we've changed some aspects of the proxy's internals significantly between 2.12 and 2.13, and may have fixed this issue in the process.
Other than that, I'd love to know what's going on here, but without a self-contained reproduction, there's not a lot I can do...
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
To clarify the recent label and status changes here: yup, we've seen some things around this that make us curious and we're doing further investigation.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
What is the issue?
In one of our production services, we see a memory leak that grows slowly over time but ends up using up to the 500MB limit before it is finally killed after running out of memory.
The service topology looks like so:
Istio Ingress Gateway + Linkerd Sidecar
→ http/2 →Varnish + Linkerd Sidecar
→ http/1.1 →Workload + Linkerd Sidecar
Below is a screenshot from our metrics of the linkerd-proxy sidecar memory usage of the
Workload
service in MiB:As you can see the proxy seems to be continuously allocating memory, which is unlike the other services running with the linkerd proxy where it usually sits around 20-30MB
We have managed to get a heap profile of the linkerd proxy via bytehound and the majority of the allocations are in
bytes::bytes_mut::BytesMut::reserve_inner
which seems to be related to http1 keep alive based on the call graph in the following screenshot. This seems similar to an issue raised previously in the tokio bytes repository https://github.com/tokio-rs/bytes/pull/560 and a similar issue was raised in hyper referencing this https://github.com/hyperium/hyper/issues/2924. From theCargo.lock
file for the linkerd proxy, it seems that version 1.2.1 for the bytes crate is already being used, which should have the fix in the above PR.What is interesting is that it seems like the connections between the varnish server and the backend workload are stuck in an HTTP1 state rather than being automatically upgraded to HTTP2, even after having restarted both workloads. To demonstrate:
The difference between the two requests is that the second seems to have been upgraded correctly to H2 as seen via the
version
entry in the log. It also looks like the client id has been picked up correctly from the source pod in the second request but not in the first. All pods in the above test were automatically injected with the linkerd proxy by the control plane and the backend service only accepts HTTP/1.1 requests.It seems like the issue with the memory might not happen if the proxy-to-proxy connection could be successfully upgraded to http2?
Any thoughts or recommendations for debugging are welcome, thanks in advance.
How can it be reproduced?
Unfortunately, I have not been able to reproduce the issue in any test environments, it only seems to be happening on this specific request route, through these specific services.
Logs, error output, etc
See the issue description
output of
linkerd check -o short
Environment
Possible solution
No response
Additional context
No response
Would you like to work on fixing this bug?
None