[Ovmsdev] v3 hardware disconnecting from v2 server

Mark Webb-Johnson mark at webb-johnson.net
Wed Jan 31 08:46:17 HKT 2018


> 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.


Trying to repeat this, but can’t. Here is what I get:

OVMS > server v2 start
Launching OVMS Server V2 connection (oscv2)
I (40161) ovms-server-v2: OVMS Server V2 registered metric modifier is #1
I (40161) ovms-server-v2: Status: Starting
I (40161) ovms-server-v2: OVMS Server v2 running
I (40171) ovms-server-v2: Connection is api.openvehicles.com:6867 X/Y
I (40171) ovms-server-v2: Status: Connecting...
I (40641) ovms-server-v2: Connection successful
I (40641) ovms-server-v2: Status: Logging in...
I (40641) ovms-server-v2: Sending server login: MP-C 0 ...
I (40661) ovms-server-v2: Got server response: MP-S 0 ...
I (40661) ovms-server-v2: Server token is ...
I (40671) ovms-server-v2: Status: Server auth ok. Now priming crypto.
I (40671) ovms-server-v2: Shared secret key is ...
I (40671) ovms-server-v2: Status: OVMS V2 login successful, and crypto channel established
I (40681) ovms-server-v2: Incoming Msg: MP-0 Z0
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
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
I (41451) ovms-server-v2: Send MP-0 L22.280869,114.160599,10,30,1,0,0,0,0.0,0,0
I (41451) ovms-server-v2: Send MP-0 W30,33,40,34,30,33,40,34,0
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

OVMS > server v2 stop
Stopping OVMS Server V2 connection (oscv2)
E (45601) ovms-server-v2: Status: Error: Disconnected from OVMS Server V2

Tried a dozen times or so.

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?

> 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?

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.

Regards, Mark

> On 30 Jan 2018, at 6:53 PM, Tom Parker <tom at carrott.org> wrote:
> 
> On 29/01/18 13:07, Mark Webb-Johnson wrote:
>> 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?
> 
> 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.
> 
> 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.
> 
> I suppose it would have been quicker to recompile with gdb enabled than to stare at the code, but that's for tomorrow.
> 
> 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?
> 
> I (55374) ovms-server-v2: Send MP-0 W0,0,0,0,0,0,0,0,0
> 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
> OVMS > server v2 stop
> Stopping OVMS Server V2 connection (oscv2)
> Guru Meditation Error: Core  1 panic'ed (LoadProhibited)
> . Exception was unhandled.
> Register dump:
> PC      : 0x40121a5a  PS      : 0x00060330  A0      : 0x8014fb4f A1      : 0x3ffd9ce0
> 0x40121a5a: OvmsMetrics::DeregisterListener(char const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_metrics.cpp:327
> 
> A2      : 0x3ffb6d90  A3      : 0x3f41749c  A4      : 0x3ffdfa1d A5      : 0x3ffdb89c
> A6      : 0x3ffdb8ac  A7      : 0x3ffdb8ac  A8      : 0x00000000 A9      : 0x3ffd9cc0
> A10     : 0x3ffdd244  A11     : 0x3ffdb904  A12     : 0x3ffd9cf0 A13     : 0x3ffae8d8
> A14     : 0x00000000  A15     : 0x00000000  SAR     : 0x00000018 EXCCAUSE: 0x0000001c
> EXCVADDR: 0x00000004  LBEG    : 0x400014fd  LEND    : 0x4000150d LCOUNT  : 0xfffffff5
> 
> 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
> 0x40121a5a: OvmsMetrics::DeregisterListener(char const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_metrics.cpp:327
> 0x4014fb4c: OvmsServerV2::~OvmsServerV2() at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp:1616
> 0x4014fbee: OvmsServerV2::~OvmsServerV2() at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/components/ovms_server_v2/src/ovms_server_v2.cpp:1625
> 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)
> 0x4012ad9e: OvmsCommand::Execute(int, OvmsWriter*, int, char const* const*) at /vagrant/Open-Vehicle-Monitoring-System-3/vehicle/OVMS.V3/main/./ovms_command.cpp:83
> 
> 
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20180131/11b5b687/attachment.htm>


More information about the OvmsDev mailing list