dc9531d302
When a connection is closed by the client before we have enough data to determine if it contains a TLS Handshake or not, the socket stays in a readable state. While we setup a tokio backed timeout of 10s for the connection build-up here, this timeout does not trigger on said early connection abort from the client side, causing then the async_io loop to endlessly loop around peeking into the client, which always returns the last available bytes before the connection was closed. This in turn causes 100% CPU usage for one of the PBS threads. The timeout not triggering is rather odd, and does indicate some potential for further improvement in tokio itself, but our questionable use of the WouldBlock error does violate the API contract, so this is not a clear cut. Such an early connection abort is often triggered by monitoring solutions, which use it to relatively cheaply check if TCP on a port still works as "is service up" heuristic. To fix this, save the amount of bytes peek returned and if they did not change between invocations of the callback, we can assume that the connection was closed and thus exit the connection attempt with an error. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> [ TL: reword commit message and change error to ConnectionAborted ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> |
||
---|---|---|
.. | ||
debian | ||
examples | ||
src | ||
Cargo.toml |