proxy: fix memory leak (#5472)

## Problem

these JoinSets live for the duration of the process. they might have
many millions of connections spawned on them and they never get cleared.

Fixes #4672 

## Summary of changes

Drain the connections as we go
This commit is contained in:
Conrad Ludgate
2023-10-05 07:30:28 +01:00
committed by GitHub
parent c5ea91f831
commit c216b16b0f
2 changed files with 10 additions and 0 deletions

View File

@@ -168,6 +168,11 @@ async fn task_main(
.instrument(tracing::info_span!("handle_client", ?session_id))
);
}
Some(Err(e)) = connections.join_next(), if !connections.is_empty() => {
if !e.is_panic() && !e.is_cancelled() {
warn!("unexpected error from joined connection task: {e:?}");
}
}
_ = cancellation_token.cancelled() => {
drop(listener);
break;

View File

@@ -130,6 +130,11 @@ pub async fn task_main(
}),
);
}
Some(Err(e)) = connections.join_next(), if !connections.is_empty() => {
if !e.is_panic() && !e.is_cancelled() {
warn!("unexpected error from joined connection task: {e:?}");
}
}
_ = cancellation_token.cancelled() => {
drop(listener);
break;