Skip to content

Commit 1223447

Browse files
authored
outbound: don't double-wrap replay bodies (#1036)
In PR #1020, the retry code was changed so that bodies are only wrapped in a `ReplayBody` when the request will be retried. The intention was to remove the `replay::layer` pushed to the stack before the retry layer, so that bodies are only wrapped when retries are enabled for the route, and not for all routes in a profile. However, I somehow managed to not remove the `replay::layer` from the stack (possibly due to a messed up rebase). Oops. This meant that all bodies for endpoints with service profiles were wrapped, and when the route has retries enabled, it's wrapped twice. When wrapped twice, this means that we potentially buffer the body data *twice*.
1 parent 0e6df7c commit 1223447

File tree

2 files changed

+0
-7
lines changed

2 files changed

+0
-7
lines changed

linkerd/app/outbound/src/http/logical.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ impl<E> Outbound<E> {
122122
)
123123
// Sets an optional retry policy.
124124
.push(retry::layer(rt.metrics.http_route_retry.clone()))
125-
.push_on_response(retry::replay::layer())
126125
// Sets an optional request timeout.
127126
.push(http::MakeTimeoutLayer::default())
128127
// Records per-route metrics.

linkerd/http-retry/src/replay.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use bytes::{Buf, BufMut, Bytes, BytesMut};
22
use http::HeaderMap;
33
use http_body::Body;
4-
use linkerd_stack as svc;
54
use parking_lot::Mutex;
65
use std::{collections::VecDeque, io::IoSlice, pin::Pin, sync::Arc, task::Context, task::Poll};
76

@@ -71,11 +70,6 @@ struct BodyState<B> {
7170
is_completed: bool,
7271
}
7372

74-
pub fn layer<B: Body>() -> svc::MapTargetLayer<fn(http::Request<B>) -> http::Request<ReplayBody<B>>>
75-
{
76-
svc::MapTargetLayer::new(|req: http::Request<B>| req.map(ReplayBody::new))
77-
}
78-
7973
// === impl ReplayBody ===
8074

8175
impl<B: Body> ReplayBody<B> {

0 commit comments

Comments
 (0)