Coder Social home page Coder Social logo

crash in the file ocpp-config.jsn about microocpp HOT 4 OPEN

Aylaa1 avatar Aylaa1 commented on June 26, 2024
crash in the file ocpp-config.jsn

from microocpp.

Comments (4)

Aylaa1 avatar Aylaa1 commented on June 26, 2024

Hi @matth-x , is there any update on this issue? could you please prioritize.
Thank you,
Aylaa

from microocpp.

matth-x avatar matth-x commented on June 26, 2024

Hi @Aylaa1,

To change configurations programatically, use the Configuration API like here:

auto MeterValueSampleIntervalInt = declareConfiguration<int>("MeterValueSampleInterval",0, CONFIGURATION_FN);
MeterValueSampleIntervalInt->setInt(10);

The first call gets a handle for the Config, the second call effectively changes its value. The same functions exist for strings and bools. You can see more usage examples in the file "Metering.cpp" I linked above.

Also #include <MicroOcpp/Core/Configuration.h> to get access to the Configuration API. Perform the changes after mocpp_initialize().

Manually manipulating the contents of the JSON files is without effect after initialization of the library. And before initialization it is risky, because I do not test such interaction with the firmware.

from microocpp.

Aylaa1 avatar Aylaa1 commented on June 26, 2024

Hi @matth-x,
Thanks you for the response,
the sequence you have mentioned is followed the same way, i.e., mocpp_initialize() is called first and later the configuration related apis.
The actual problem is when the ocpp-config.json file is reaching the size above 1024(eg 1031), the application crashes.
If I restrict the jsonCapacity to 1024 in (DynamicJsonDocument doc {jsonCapacity}), but the jsonCapacity calculated in the runtime is 1031, json file would be invalid and the application still crashes.
The crash still persists if I increase the jsonCapacity to Max json capacity(4096).
Basically I observe crash if I try to write anything more than 1024 bytes to ocpp-config.jsn file.

The problem does not occur, if I reduce the number of key-value pairs written to the ocpp-config.jsn file in such a way that the file size will not cross 1024 bytes.

(All other jsn files are below 1024 bytes except ocpp-config.jsn file, throughout the application like bootstats.jsn, ws-conn.jsn, sc-tx-1-0.jsn, ...)

PFA, the crash scenario log snips
Crash1
crash2

Thanks,
Aylaa

from microocpp.

matth-x avatar matth-x commented on June 26, 2024

Hi @Aylaa1,

Sorry, I'm still lacking an idea what could happen here. The most suspicious thing I see is that the application crashes due to a stack overflow. Normally, the stack stack size should rarely grow with payload data. Did you integrate a custom filesystem adapter which has payload buffers on the stack by any chance?

However, it is true that the default stack size in esp-idf is too small to run MicroOcpp. I increased it to 8192 in the example project:

CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192

from microocpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.