IsoTpParallelQuery: log all timeouts (#28325)

* log

* self explan

* clean up

* revert

* need a better name

* move

* bvack
old-commit-hash: 026c093d05dfc05a9a04ff341942e5b9858a12f7
This commit is contained in:
Shane Smiskol
2023-05-27 22:14:50 -07:00
committed by GitHub
parent 8ddf02e69b
commit 6064fbb5e3
+9 -2
View File
@@ -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)