<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Craig,<br>
<br>
<div class="moz-cite-prefix">Am 18.09.21 um 00:14 schrieb Craig
Leres:<br>
</div>
<blockquote type="cite"
cite="mid:491f66fc-5bf6-9e74-4309-9dc6c1625474@xse.com">
On 9/17/21 12:24 AM, Michael Balzer wrote:
<br>
<blockquote type="cite">
Duktape still occasionally runs into the null/undefined issue
with for…in:
<br>
<a class="moz-txt-link-freetext" href="https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/474#issuecomment-744005044">https://github.com/openvehicles/Open-Vehicle-Monitoring-System-3/issues/474#issuecomment-744005044</a>
<br>
We need to test the revision 3 ESP32 on this.
<br>
</blockquote>
<br>
What can I do to test this on my frankenstein v3 module?
<br>
</blockquote>
<br>
Here's a simple test that reliably reproduces the effect on my
modules:<br>
<ol>
<li>Setup handler loop: <font face="monospace">script eval
'PubSub.subscribe("usr.testev", function(ev) { var
ms=Number(ev.substr(11))||10;
OvmsEvents.Raise("usr.testev."+ms, ms); })'</font></li>
<li>Start event loop with 10 ms interval: <font face="monospace">event
raise usr.testev.10</font></li>
</ol>
<p>The handler will keep raising the same event with the given
interval. You can monitor the events by settingt log level debug
on events or using the event tracing (<font face="monospace">event
trace on/off</font>), be aware 10 ms will flood your
terminal/shell. Check the Duktape CPU usage to see if the loop is
still running without enabling the event log.<br>
</p>
<p>The loop <u>should</u> normally run indefinitely. To stop it
manually, you would do: <font face="monospace">script eval
'PubSub.unsubscribe("usr.testev")'</font><br>
</p>
In reality, it will abort after some random run time with a log
entry like this:<br>
<br>
<font face="monospace">E (1803740) ovms-duktape: [int/PubSub.js:1]
TypeError: not object coercible| at [anon]
(duk_api_stack.c:3661) internal| at hasKeys (int/PubSub.js:1)
strict| at messageHasSubscribers (int/PubSub.js:1) strict|
at publish (int/PubSub.js:1) strict| at [anon]
(int/PubSub.js:1) strict preventsyield</font><br>
<br>
…or (newly discovered today) with a heap corruption crash, which may
have another cause though (investigating).<br>
<br>
If it stops with the "TypeError", the loop should be restartable
simply by repeating step 2. That proves the PubSub handler setup is
still intact.<br>
<br>
The time it needs to run into the TypeError varies widely and has
some dependance on how many other handlers are registered. With no
other javascript handlers registered, it normally takes 15-30
minutes on my modules to run into the error. With AuxBatMon, PwrMon
& Edimax plugins enabled, it will normally happen within 5
minutes, sometimes within a few seconds.<br>
<br>
The interval is basically irrelevant, the effect just comes faster
with a short interval.<br>
<br>
Regards,<br>
Michael<br>
<br>
PS: btw, the effect occurs with Duktape running in the upper 2 MB as
well. That doesn't prove it's not the SPIRAM bug though, it just may
have other trigger conditions.<br>
<br>
<pre class="moz-signature" cols="72">--
Michael Balzer * Helkenberger Weg 9 * D-58256 Ennepetal
Fon 02333 / 833 5735 * Handy 0176 / 206 989 26</pre>
</body>
</html>