]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
conn: Avoid non fatal assert under memory pressure
authorDavid Goulet <dgoulet@torproject.org>
Thu, 13 Nov 2025 13:57:57 +0000 (08:57 -0500)
committerDavid Goulet <dgoulet@torproject.org>
Thu, 13 Nov 2025 19:45:58 +0000 (14:45 -0500)
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>
src/core/or/connection_edge.c

index f21779a80c2feb5f609e911922d482ce0ce76e10..6231c2125a3af8be1a949ccabe9cd19cd590daba 100644 (file)
@@ -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?",