<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div><div class=""><blockquote type="cite" class="">Stopping the v2 server causes a panic even when it has connected right after boot. The below stack trace is from current master. Looking at the code where it panics, it seems like the MetricCallbackList is corrupted somehow.</blockquote></div><div class=""><br class=""></div>Trying to repeat this, but can’t. Here is what I get:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">OVMS > server v2 start</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Launching OVMS Server V2 connection (oscv2)</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40161) ovms-server-v2: OVMS Server V2 registered metric modifier is #1</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40161) ovms-server-v2: Status: Starting</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40161) ovms-server-v2: OVMS Server v2 running</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40171) ovms-server-v2: Connection is <a href="http://api.openvehicles.com:6867" class="">api.openvehicles.com:6867</a> X/Y</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40171) ovms-server-v2: Status: Connecting...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40641) ovms-server-v2: Connection successful</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40641) ovms-server-v2: Status: Logging in...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40641) ovms-server-v2: Sending server login: MP-C 0 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40661) ovms-server-v2: Got server response: MP-S 0 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40661) ovms-server-v2: Server token is ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40671) ovms-server-v2: Status: Server auth ok. Now priming crypto.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40671) ovms-server-v2: Shared secret key is ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40671) ovms-server-v2: Status: OVMS V2 login successful, and crypto channel established</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (40681) ovms-server-v2: Incoming Msg: MP-0 Z0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (41441) ovms-server-v2: Send MP-0 S50,K,0,0,done,standard,200,160,0,0,0,0,13,4,0,0,0,0,160.00,0,0,0,0,-1,0,0,0,0,0,400,0,0.00,400.00,100</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (41441) ovms-server-v2: Send MP-0 D0,0,5,22,30,25,0,1000000,0,41,22,0,0,0,0,0,0,0,22,0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (41451) ovms-server-v2: Send MP-0 L22.280869,114.160599,10,30,1,0,0,0,0.0,0,0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (41451) ovms-server-v2: Send MP-0 W30,33,40,34,30,33,40,34,0</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (41451) ovms-server-v2: Send MP-0 F3.0.0/factory/main build (idf v3.1-dev-217-g5bf85d06) Jan 30 2018 07:43:15,DEMODEMODEMO,0,1,DEMO,STUBBY</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">OVMS > server v2 stop</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Stopping OVMS Server V2 connection (oscv2)</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">E (45601) ovms-server-v2: Status: Error: Disconnected from OVMS Server V2</span></font></div></div></blockquote><div class=""><div><br class=""></div><div>Tried a dozen times or so.</div><div><br class=""></div><div>Is there anything special you do to cause this? Can you try the above simple case and see if you get the crash? What does your ‘module memory’ look like with v2 server running?</div><div><br class=""></div><div><blockquote type="cite" class="">I did notice what looks like a memory leak, EventCallbackEntry objects are new'ed and added to the list in RegisterEvent, but they're only removed from the list in OvmsEvents::DeregisterEvent(). I think they should be delete'ed too?</blockquote><br class=""></div><div>Yep, that is not good. I found the same in metrics and notifications. Fixed all three. There are still memory leaks elsewhere (module memory is showing them), but that is a start.</div><div><br class=""></div><div>Regards, Mark</div><div><br class=""><blockquote type="cite" class=""><div class="">On 30 Jan 2018, at 6:53 PM, Tom Parker <<a href="mailto:tom@carrott.org" class="">tom@carrott.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 29/01/18 13:07, Mark Webb-Johnson wrote:<br class=""><blockquote type="cite" class="">The bigger issue is the PPP level, and I’m not sure how to reliably detect issues there. Also not sure if the issue you are seeing is at the TCP server connection level, or low level PPP transport. Do you know if you restart the v2 server module, but leave the simcom connection as it is, does that resolve it?<br class=""></blockquote><br class="">Stopping the v2 server causes a panic even when it has connected right after boot. The below stack trace is from current master. Looking at the code where it panics, it seems like the MetricCallbackList is corrupted somehow.<br class=""><br class="">I commented out the MyMetrics.RegisterListener call in ovms_server_v2.cpp and got basically the same crash in OvmsEvents::DeregisterEvent so something strange is going on. I read the documentation for std::list and it looks like it's doing the right thing. Hmm... could the ec->m_caller == caller explode if the caller passed to RegisterEvent has been freed? My naive understanding of C++ would suggest no, because a pointer to invalid memory does not equal a pointer to valid memory, but I wouldn't be surprised if == does something other than pointer comparison sometimes. The caller is only accessed during deregister, so things would operate normally until you try to deregister.<br class=""><br class="">I suppose it would have been quicker to recompile with gdb enabled than to stare at the code, but that's for tomorrow.<br class=""><br class="">I did notice what looks like a memory leak, EventCallbackEntry objects are new'ed and added to the list in RegisterEvent, but they're only removed from the list in OvmsEvents::DeregisterEvent(). I think they should be delete'ed too?<br class=""><br class="">I (55374) ovms-server-v2: Send MP-0 W0,0,0,0,0,0,0,0,0<br class="">I (55374) ovms-server-v2: Send MP-0 F3.0.0/factory/main build (idf v3.1-dev-217-g5bf85d0) Jan 30 2018 10:07:33,,5,1,NL,2degrees<br class="">OVMS > server v2 stop<br class="">Stopping OVMS Server V2 connection (oscv2)<br class="">Guru Meditation Error: Core 1 panic'ed (LoadProhibited)<br class="">. Exception was unhandled.<br class="">Register dump:<br class="">PC : 0x40121a5a PS : 0x00060330 A0 : 0x8014fb4f A1 : 0x3ffd9ce0<br class="">0x40121a5a: OvmsMetrics::DeregisterListener(char const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_metrics.cpp:327<br class=""><br class="">A2 : 0x3ffb6d90 A3 : 0x3f41749c A4 : 0x3ffdfa1d A5 : 0x3ffdb89c<br class="">A6 : 0x3ffdb8ac A7 : 0x3ffdb8ac A8 : 0x00000000 A9 : 0x3ffd9cc0<br class="">A10 : 0x3ffdd244 A11 : 0x3ffdb904 A12 : 0x3ffd9cf0 A13 : 0x3ffae8d8<br class="">A14 : 0x00000000 A15 : 0x00000000 SAR : 0x00000018 EXCCAUSE: 0x0000001c<br class="">EXCVADDR: 0x00000004 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffff5<br class=""><br class="">Backtrace: 0x40121a5a:0x3ffd9ce0 0x4014fb4c:0x3ffd9d00 0x4014fbee:0x3ffd9d40 0x4014f117:0x3ffd9d60 0x4012ad9e:0x3ffd9d80 0x4012ae91:0x3ffd9db0 0x4012ae83:0x3ffd9de0 0x4012ae83:0x3ffd9e10 0x4012aeb9:0x3ffd9e40 0x401228b8:0x3ffd9e60 0x4012dbfd:0x3ffd9e80 0x4012dc64:0x3ffd9ee0 0x4012292f:0x3ffd9f20 0x40122946:0x3ffd9f40 0x40122e89:0x3ffd9f60 0x40125811:0x3ffd9f90 0x40125a09:0x3ffd9fc0 0x40122d2d:0x3ffd9fe0 0x40122d3c:0x3ffda000 0x40125481:0x3ffda020<br class="">0x40121a5a: OvmsMetrics::DeregisterListener(char const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_metrics.cpp:327<br class="">0x4014fb4c: OvmsServerV2::~OvmsServerV2() at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp:1616<br class="">0x4014fbee: OvmsServerV2::~OvmsServerV2() at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp:1625<br class="">0x4014f117: ovmsv2_stop(int, OvmsWriter*, OvmsCommand*, int, char const* const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp:1659 (discriminator 1)<br class="">0x4012ad9e: OvmsCommand::Execute(int, OvmsWriter*, int, char const* const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_command.cpp:83<br class=""><br class=""><br class="">_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.teslaclub.hk" class="">OvmsDev@lists.teslaclub.hk</a><br class="">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br class=""></div></div></blockquote></div><br class=""></div></body></html>