Skip to content

outbound: Fix incorrect l5d-proxy-connection logs#2344

Merged
olix0r merged 8 commits intomainfrom
ver/proxy-connection
Mar 21, 2023
Merged

outbound: Fix incorrect l5d-proxy-connection logs#2344
olix0r merged 8 commits intomainfrom
ver/proxy-connection

Conversation

@olix0r
Copy link
Member

@olix0r olix0r commented Mar 19, 2023

We've received reports of proxies inexplicibly emiting log lines including "Received unmeshed response with l5d-proxy-connection set". These messages may arise when the endpoint stack returns a synthesized response.

Furthermore, we have a note in the code explaining that this connection closure logic should not apply to load balanced requests, though it currently is.

This change fixes both of these issues:

  • The HTTP error responding module now inserts a Synthesized marker to responses so that other modules can determine when a response was generated locally.
  • The proxy_connection_close module is updated so that we ignore responses with this extension set.
  • Furthermore, it does not apply the Connection: close behavior unless the new Closable marker extension is present.
  • The marker is only set when using a forwarding backend.

@olix0r olix0r requested a review from a team as a code owner March 19, 2023 22:28
@olix0r olix0r force-pushed the ver/proxy-connection branch from 160133d to 6d1468b Compare March 19, 2023 22:33
@olix0r olix0r marked this pull request as draft March 19, 2023 22:35
@olix0r olix0r force-pushed the ver/proxy-connection branch 5 times, most recently from 275c301 to 3b6e905 Compare March 20, 2023 00:13
We've received reports of proxies inexplicibly emiting log lines
including "Received unmeshed response with l5d-proxy-connection set".
These messages may arise when the endpoint stack returns a synthesized
response.

Furthermore, we have a note in the code explaining that this connection
closure logic should not apply to load balanced requests, though it
currently is.

This change fixes both of these issues:

* The proxy_connection_close module is renamed to
  handle_proxy_error_headers.
* It is now only applied in the endpoint stack. It doesn't make any
  sense for it to be applied in the server stack, since we'll already
  have cleared any headers set by peers. Removing this module prevents
  the application of teardown logic on synthetic responses.
* `NewHandleProxyErrorHeaders` is now configured by a `Closable`
  parameter that determines whether teardown logic should be applied.
  This parameter is only enabled when forwarding to a single endpoint.
  No teardown logic is applied when load balancing.
* In a future change, we should stop emitting l5d-proxy-connection when
  synthesizing outbound responses.
@olix0r olix0r force-pushed the ver/proxy-connection branch from 3b6e905 to 78ffb2d Compare March 20, 2023 00:14
Copy link
Contributor

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment on lines +60 to +61
X: svc::ExtractParam<Closable, T>,
X: svc::ExtractParam<tls::ConditionalClientTls, T>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really want to use the same ExtractParam impl to extract both of these? i realize this probably doesn't actually matter as it looks like in practice, the ExtractParam impl is currently always (), and this is just here for future-proofing...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can change it later if it needs to be changed.

@olix0r olix0r marked this pull request as ready for review March 20, 2023 23:45
@olix0r olix0r merged commit ebb0496 into main Mar 21, 2023
@olix0r olix0r deleted the ver/proxy-connection branch March 21, 2023 00:38
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Mar 21, 2023
Both outbound and gateway proxies now resolve client policies from the
OutboundPolicies API. When the outbound proxy attempts to discover a
policy and the policy controller returns NotFound, it synthesizes a
default policy from the discovered ServiceProfile. However, when the
gateway proxy receives a NotFound, it will currently fail the
connection, based on the assumption that only valid cluster DNS names
are gatewayed (and not arbitrary IPs that might be forwards).
Unfortunately, this is not quite true. Gateway proxies may attempt to
discover cluster DNS names that are Pod DNS names, rather than Service
DNS names, and the policy controller will return NotFound for those
names.

This branch therefore changes the gateway proxy to also synthesize
default ClientPolicies based on the ServiceProfile when receiving a
NotFound status. Some of the code for synthesizing a client policy
from a ServiceProfile that's currently used in the outbound proxy was
factored out so that it could be reused here.

---

* gateway: move discovery resolver into its own file (linkerd/linkerd2-proxy#2343)
* outbound: Fix incorrect l5d-proxy-connection logs (linkerd/linkerd2-proxy#2344)
* gateway: synthesize ClientPolicies when the controller returns `NotFound` (linkerd/linkerd2-proxy#2333)

Signed-off-by: Oliver Gould <ver@buoyant.io>
olix0r added a commit to linkerd/linkerd2 that referenced this pull request Mar 21, 2023
* proxy: v2.193.0

This proxy release changes the multicluster gateway to discover Gateway
API routes via the `OutboundPolicy` API. This builds on the similar
changes to the outbound proxy in v2.192.

---

* gateway: discover client policies from the policy controller (linkerd/linkerd2-proxy#2315)
* build(deps): bump windows_x86_64_msvc from 0.42.1 to 0.42.2 (linkerd/linkerd2-proxy#2319)
* build(deps): bump proc-macro2 from 1.0.51 to 1.0.52 (linkerd/linkerd2-proxy#2320)
* outbound: Apply filters to outbound requests (linkerd/linkerd2-proxy#2260)
* test: add mock client policy resolver (linkerd/linkerd2-proxy#2314)
* build(deps): bump tj-actions/changed-files from 35.6.4 to 35.7.0 (linkerd/linkerd2-proxy#2318)
* build(deps): bump axum from 0.6.10 to 0.6.11 (linkerd/linkerd2-proxy#2321)
* build(deps): bump ryu from 1.0.12 to 1.0.13 (linkerd/linkerd2-proxy#2322)
* build(deps): bump windows_x86_64_gnullvm from 0.42.1 to 0.42.2 (linkerd/linkerd2-proxy#2323)
* outbound: Eagerly cancel synthesized profile task (linkerd/linkerd2-proxy#2317)
* outbound: Simplify discovery debug logging (linkerd/linkerd2-proxy#2316)
* build(deps): bump tj-actions/changed-files from 35.6.1 to 35.6.4 (linkerd/linkerd2-proxy#2309)

* proxy: v2.193.1

* outbound: fix `Balance::Dispatch` "authority" labels (linkerd/linkerd2-proxy#2332)
* outbound: refactor `discover::resolver` into a method (linkerd/linkerd2-proxy#2331)

* proxy: v2.193.2

Both outbound and gateway proxies now resolve client policies from the
OutboundPolicies API. When the outbound proxy attempts to discover a
policy and the policy controller returns NotFound, it synthesizes a
default policy from the discovered ServiceProfile. However, when the
gateway proxy receives a NotFound, it will currently fail the
connection, based on the assumption that only valid cluster DNS names
are gatewayed (and not arbitrary IPs that might be forwards).
Unfortunately, this is not quite true. Gateway proxies may attempt to
discover cluster DNS names that are Pod DNS names, rather than Service
DNS names, and the policy controller will return NotFound for those
names.

This branch therefore changes the gateway proxy to also synthesize
default ClientPolicies based on the ServiceProfile when receiving a
NotFound status. Some of the code for synthesizing a client policy
from a ServiceProfile that's currently used in the outbound proxy was
factored out so that it could be reused here.

---

* gateway: move discovery resolver into its own file (linkerd/linkerd2-proxy#2343)
* outbound: Fix incorrect l5d-proxy-connection logs (linkerd/linkerd2-proxy#2344)
* gateway: synthesize ClientPolicies when the controller returns `NotFound` (linkerd/linkerd2-proxy#2333)

Signed-off-by: Oliver Gould <ver@buoyant.io>

---------

Signed-off-by: Oliver Gould <ver@buoyant.io>
Co-authored-by: Oliver Gould <ver@buoyant.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants