[Ovmsdev] Branch for-v3.3 network issues

Michael Balzer dexter at expeedo.de
Mon Sep 27 02:57:07 HKT 2021

Am 26.09.21 um 19:28 schrieb Michael Balzer:
> a) we've got a real heap corruption issue that sometimes gets 
> triggered by the test. I've had it twice around the same place, i.e. 
> within the scheduled event processing. I'll check my code. 

I think I've found a multicore race condition in FreeRTOS.

For the scheduled events, I keep a list of timers. Walking through the 
list, I call xTimerIsTimerActive() to check if a timer is available.

When a timer is due, prvProcessExpiredTimer() takes care of calling the 
callback. Here's the issue: before it does that, it removes the timer 
from the active list.

xTimerIsTimerActive() checks if the timer is in the "active" list of the 
timer service. So xTimerIsTimerActive() will return false on a timer 
before the callback actually has begun.

The current FreeRTOS version solves this by introducing a timer status 
flag instead of checking the list association, but esp-idf 3.3 includes 
the outdated version 8.2.0.

I currently test a workaround for this regarding the events system 
(introducing my own status map), which seems to fix the issue -- 180.000 
events & counting.

I've used xTimerIsTimerActive() in the websocket handler and in the 
OvmsTimer class as well, so need to check if these need similar workarounds.


Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 203 bytes
Desc: OpenPGP digital signature
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20210926/48e4a5c1/attachment-0001.sig>

More information about the OvmsDev mailing list