tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit 699f085b911149dce05333b96130f5c9f941d081
parent 89cac03ea7272a0a6266bdc2951de5d2d8dc3191
Author: David Goulet <dgoulet@torproject.org>
Date:   Thu, 13 Nov 2025 08:57:57 -0500

conn: Avoid non fatal assert under memory pressure

The OOM handler can close connections without sending an END cell so in that
case, avoid a non fatal assert.

Signed-off-by: David Goulet <dgoulet@torproject.org>

Diffstat:
Msrc/core/or/connection_edge.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/core/or/connection_edge.c b/src/core/or/connection_edge.c @@ -1078,7 +1078,9 @@ static mainloop_event_t *attach_pending_entry_connections_ev = NULL; static void connection_edge_about_to_close(edge_connection_t *edge_conn) { - if (!edge_conn->edge_has_sent_end) { + /* Under memory pressure, the OOM handler can close connections without + * sending END cell. If we are NOT in that scenario, log loudly. */ + if (!edge_conn->edge_has_sent_end && !have_been_under_memory_pressure()) { connection_t *conn = TO_CONN(edge_conn); log_warn(LD_BUG, "(Harmless.) Edge connection (marked at %s:%d) " "hasn't sent end yet?",