From 36630fa2bc8145cd57a5b4d53ae1d6eff0b6d8f3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois-Simon=20Fauteux-Chapleau?=
 <francois-simon.fauteux-chapleau@savoirfairelinux.com>
Date: Thu, 1 May 2025 11:06:07 -0400
Subject: [PATCH] ice_transport: edit misleading error message

In pj_stun_client_tsx_send_msg, the timeout for a STUN transaction is
set to 16 times its RTO, which is 500 ms in our case (see the
IceTransportFactory constructor). This means that the timer heap can
contain timers with values of up to 16 * 500 = 8000 ms.

When an IceTransport::Impl object gets destroyed, the
flushTimerHeapAndIoQueue function is called and attempts to process the
remaining timers in the timer heap. However, the amount of time it can
spend doing this is limited by the value of MAX_DESTRUCTION_TIMEOUT,
which is currently 3000 ms. Since this is less than the timeout for a
STUN transaction, it is expected that there will sometimes be timers
left in the heap (especially in case of connectivity changes, which make
it more likely that STUN messages will need to be retransmitted).

Change-Id: I309250923425f9e325b39b63bfd9380cff3eec91
---
 src/ice_transport.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp
index df15c24..e8bf8a6 100644
--- a/src/ice_transport.cpp
+++ b/src/ice_transport.cpp
@@ -375,9 +375,7 @@ IceTransport::Impl::~Impl()
                 logger_->error("[ice:{}] I/O queue polling failed", fmt::ptr(this));
         } else if (ret > 0) {
             if (logger_)
-                logger_->error("[ice:{}] Unexpected left timer in timer heap. "
-                     "Please report the bug",
-                     fmt::ptr(this));
+                logger_->warn("[ice:{}] {} timers left in timer heap.", fmt::ptr(this), ret);
         }
 
         if (checkEventQueue(1) > 0) {
-- 
GitLab