[Ovmsdev] V3 progress

Mark Webb-Johnson mark at webb-johnson.net
Wed Oct 11 14:36:07 HKT 2017

I think this double-free may be related to the new event script system Steve and I have been working on (in preparation for SMS, etc).

@steve: That seems to be on 'free(event.buffer)’ at ovms_console.cpp:215. One of those nasty ‘passing around pointers, and who is responsible for freeing’ issues, I guess. Can you try to reproduce the fault?

Thanks, Mark.

> On 11 Oct 2017, at 1:52 PM, Tom Parker <tom at carrott.org> wrote:
> On 11/10/17 13:02, Mark Webb-Johnson wrote:
>> Tom,
>> I think your problem is sdkconfig. That has settings for partition table, fat filesystem, and timer task stack size; all three of your issues.
>> Can you try to diff your sdkconfig against sdkconfig.default (which contains all the custom settings)? Or just copy sdkconfig.default over your sdkconfig, and then adjust appropriately for what you need custom? You’ll need to ‘make menuconfig’ to confirm things, then I suggest ‘make clean’ and ‘make flash’ to flash everything (partition table, bootloader, etc).
> That worked! My sdkconfig was quite far from the default.
> Your untested scripts recommendation didn't work as they need to be stored in the events directory, this works:
> vfs mkdir /store/events
> vfs mkdir /store/events/system.start
> vfs append "wifi mode client <ssid>" /store/events/system.start/startmeup
> vfs append "vehicle module NL" /store/events/system.start/startmeup
> vfs mkdir /store/events/network.up
> vfs append "server v2 start" /store/events/network.up/startmeup
> With these in place I get a reboot loop:
> I (5822) event: ip:, mask:, gw:
> I (5822) ovms-mdns: Launching MDNS service
> I (5832) script: Running script /store/events/network.up/startmeup
> Launching OVMS Server V2 connection (oscv2)/home/ubuntu/esp/esp-idf/components/freertos/./heap_regions.c:368 (vPortFreeTagged)- assert failed!
> abort() was called at PC 0x40085f8f on core 1
> 0x40085f8f: vPortFreeTagged at /home/ubuntu/esp/esp-idf/components/freertos/./heap_regions.c:410
> Backtrace: 0x40088680:0x3ffebe80 0x4008877f:0x3ffebea0 0x40085f8f:0x3ffebec0 0x40088cd1:0x3ffebee0 0x40081f89:0x3ffebf00 0x4000bec7:0x3ffebf20 0x400eff2a:0x3ffebf40 0x400eff54:0x3ffebf70 0x400efcc0:0x3ffebf90
> 0x40088680: invoke_abort at /home/ubuntu/esp/esp-idf/components/esp32/./panic.c:519
> 0x4008877f: abort at /home/ubuntu/esp/esp-idf/components/esp32/./panic.c:519
> 0x40085f8f: vPortFreeTagged at /home/ubuntu/esp/esp-idf/components/freertos/./heap_regions.c:410
> 0x40088cd1: vPortFree at /home/ubuntu/esp/esp-idf/components/esp32/./heap_alloc_caps.c:323
> 0x40081f89: _free_r at /home/ubuntu/esp/esp-idf/components/newlib/./syscalls.c:32
> 0x400eff2a: _ZN11OvmsConsole7ServiceEv at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_console.cpp:215
> 0x400eff54: _ZThn296_N11OvmsConsole7ServiceEv at ??:?
> 0x400efcc0: _ZN8TaskBase4TaskEPv at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./task_base.cpp:119
> Rebooting...
> If I remove the network.up/startmeup file (the file that starts the v2 server client) then it starts up ok and when I start the v2 client manually, it connects to the v2 server and everything works. I tried using the ticker.60 event and got the same crash so it's not a race condition with the wifi startup.
> The cause is a double free by the looks of it, and if I comment out the writer->puts called in the v2 server start function, things work:
> diff --git a/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp b/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
> index 106269e..d1ee797 100644
> --- a/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
> +++ b/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp
> @@ -515,7 +515,7 @@ void ovmsv2_start(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc,
>    {
>    if (MyOvmsServerV2 == NULL)
>      {
> -    writer->puts("Launching OVMS Server V2 connection (oscv2)");
> +    // writer->puts("Launching OVMS Server V2 connection (oscv2)");
>      MyOvmsServerV2 = new OvmsServerV2("oscv2");
>      }
>    }
> The ESP_LOGI in OvmsServerV2::OvmsServerV2 also gets called, in this code path but doesn't need to be commented out.
> Progress!
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

More information about the OvmsDev mailing list