linkerd2-proxy/proxy
Eliza Weisman e5ba89f225 Fix infinite loop in `tcp::HalfDuplex::copy_into()` (#537)
An infinite loop exists in the TCP proxy, which could be triggered by any raw TCP connection (including HTTPS requests). The connection will be proxied successfully, but instead of closing, it will remain open, and the proxy's CPU usage will remain extremely high indefinitely.

Since `Duplex::poll` will call `half_in.copy_into()`/`half_out.copy_into()` repeatedly, even after they return `Async::Ready`, when one half has shut down and returned ready, it may still be polled again, as `Duplex::poll` waits until _both_ halves have returned `Ready`. Because of the guard that `!dst.is_shutdown`, intended to prevent the destination from shutting down twice, the function will not return if it is polled again after returning `Async::Ready` once.

I've fixed this by moving the guard against double shutdowns out of the loop, so that the function will return `Async::Ready` again if it is polled after shutting down the destination.

I've also included a unit test against regressions to this bug. The unit test fails against master.

Fixes #519 

Signed-off-by: Eliza Weisman <eliza@buoyant.io>
Co-Authored-By: Andrew Seigner <andrew@sig.gy>
2018-03-08 12:43:19 -08:00
..
convert Prepare for the v0.3.0 release (#406) 2018-02-21 11:14:11 -08:00
futures-mpsc-lossy Prepare for the v0.3.0 release (#406) 2018-02-21 11:14:11 -08:00
router Enforce that requests are mapped to connections for each Host: header values (#492) 2018-03-06 16:44:14 -08:00
src Fix infinite loop in `tcp::HalfDuplex::copy_into()` (#537) 2018-03-08 12:43:19 -08:00
tests Simplify cluster zone suffix handling in the proxy (#528) 2018-03-07 14:30:13 -10:00
Cargo.toml Enforce that requests are mapped to connections for each Host: header values (#492) 2018-03-06 16:44:14 -08:00