From 026c093d05dfc05a9a04ff341942e5b9858a12f7 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sat, 27 May 2023 22:14:50 -0700 Subject: [PATCH] IsoTpParallelQuery: log all timeouts (#28325) * log * self explan * clean up * revert * need a better name * move * bvack --- selfdrive/car/isotp_parallel_query.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/selfdrive/car/isotp_parallel_query.py b/selfdrive/car/isotp_parallel_query.py index d6b3538840..5f8b0561a0 100644 --- a/selfdrive/car/isotp_parallel_query.py +++ b/selfdrive/car/isotp_parallel_query.py @@ -97,6 +97,7 @@ class IsoTpParallelQuery: results = {} start_time = time.monotonic() + addrs_responded = set() # track addresses that have ever sent a valid iso-tp frame for timeout logging response_timeouts = {tx_addr: start_time + timeout for tx_addr in self.msg_addrs} while True: self.rx() @@ -111,6 +112,7 @@ class IsoTpParallelQuery: # Extend timeout for each consecutive ISO-TP frame to avoid timing out on long responses if rx_in_progress: + addrs_responded.add(tx_addr) response_timeouts[tx_addr] = time.monotonic() + timeout if not dat: @@ -141,8 +143,13 @@ class IsoTpParallelQuery: cur_time = time.monotonic() for tx_addr in response_timeouts: if cur_time - response_timeouts[tx_addr] > 0: - if request_counter[tx_addr] > 0 and not request_done[tx_addr]: - cloudlog.error(f"iso-tp query timeout after receiving response: {tx_addr}") + if not request_done[tx_addr]: + if request_counter[tx_addr] > 0: + cloudlog.error(f"iso-tp query timeout after receiving partial response: {tx_addr}") + elif tx_addr in addrs_responded: + cloudlog.error(f"iso-tp query timeout while receiving response: {tx_addr}") + else: + cloudlog.error(f"iso-tp query timeout with no response: {tx_addr}") request_done[tx_addr] = True # Break if all requests are done (finished or timed out)