c-jimenez/open-ocpp

quick_start_centralsystem segmentation fault

popnukem opened this issue · 3 comments

I have built a prototype Central System using the quick_start_centralsystem in open-ocpp-1.4.0 (please see attached code main.cpp and iccs.hpp). I have two Charging Points physically attached to the Central System running on an Orange-pi PC Plus with Armbian Linux (Ubuntu 20.04). For some reason, I don't know why at this stage, both CPs randomly disconnect themselves (software disconnect) from the CS and sometimes this causes the CS software to seg fault.
As well as the source code I have dumped the contents of the build_gcc_native/examples/quick_start_centralsystem/CMakeFiles/quick_start_centralsystem.dir directory to include the make and object files. Also in the dump is a document 'ocpp seg fault 31-oct-2023' which contains the strace output of the seg fault. Also in the attached segfault.zip
segfault.zip
is the core dump.
Are you able to tell what is causing the seg fault from these files?
From the comments in the main.cpp you can see I though I'd found the cause by checking the size of event_handler.chargePoints() - see line 317, I think this may have solved one instance, but clearly there is still an issue.
many thanks
andy

Hi,
Thanks for your feedback, the quick start central system indeed contains a bug leading to crash when charging stations are connecting/disconnecting.
Note that this crash is due to an incorrect usage of smart pointers in the example, not from the code of the library itself.
I will modify the example code and keep you updated.

Hi,

The issue is fixed by the following PR : #162.

Please note that these are examples and they are not very optimized in their way of managing simultaneous communications with a lot of charging stations. They mainly here to highlight the stack's interfaces.

Hi, many thanks for this. I now have it on long-term testing with multiple CPs connected.