Giter Club home page Giter Club logo

Comments (6)

ravibhagavandas avatar ravibhagavandas commented on July 18, 2024

Since MQTTPublishInfo_t is allocated on the stack it could be possible that an unbounded write somewhere may be corrupting the stack at that location. Could you try

  • Stepping through a debugger, add a watchpoint for pPublishInfo->payloadLength and step through the lines to see which line changes the value ?

  • Try moving the MQTTPublishInfo_t pub out of function call stack to a static variable and see if problem persists. This way you could isolate if this is a stack issue

  • See if the stack size for the tasks are big enough. You can read more about debugging this here: https://www.freertos.org/FAQMem.html#StackSize

  • Enable coreMQTT debug logging to get any additional information by changing the config here to LOG_DEBUG.

from amazon-freertos.

taherrera avatar taherrera commented on July 18, 2024

Thanks,

I moved MQTTPublishInfo_t pub from the stack using static, now this is what I get:

Guru Meditation Error: Core  0 panic'ed (Double exception). 

Core  0 register dump:
PS      : 0x00050936  A0      : 0x800d1b67  A1      : 0x3fffff9c  
A2      : 0x4000000c  A3      : 0x00000000  A4      : 0x003ffbdb  A5      : 0x00403860  
A6      : 0x1049c500  A7      : 0xabffffff  A8      : 0x800d1cd5  A9      : 0x49f53049  
A10     : 0x00000000  A11     : 0x3ffbdb60  A12     : 0x1049c500  A13     : 0xe52049d5  
A14     : 0x00000000  A15     : 0xff000000  SAR     : 0x00000016  EXCCAUSE: 0x00000002  
EXCVADDR: 0x40000050  LBEG    : 0x400da114  LEND    : 0x400da131  LCOUNT  : 0x00000009  
0x400da114: findInRecord at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/libraries/coreMQTT/source/core_mqtt_state.c:434
 (inlined by) MQTT_UpdateStatePublish at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/libraries/coreMQTT/source/core_mqtt_state.c:875

0x400da131: MQTT_UpdateStatePublish at /home/tom/Documents/SLT/tecnocal/instacrop/fw/instacrop_v1/build/../amazon-freertos/libraries/coreMQTT/source/core_mqtt_state.c:849


Backtrace:0x400803bd:0x3fffff9c |<-CORRUPTED
0x400803bd: _UserExceptionVector at ??:?

I also lowered the buffer sizes in my functions that are being called by the MQTT API (send, receive), but this error remains.

I also added uxTaskGetStackHighWaterMark(NULL) to the function that sends data via uart_write_bytes and uart_read_bytes to/from the modem and it always returns 1552 (I suspect these functions are the most stack intensive calls). If I increase the buffer sizes in the stack I can see it decrease its value.

Also, how do I set configCHECK_FOR_STACK_OVERFLOW value ? I have used FreeRTOS before and it is easy to do via idf.py menuconfig → Component config → FreeRTOS → Check for stack overflow, but I do not know how to perform this in amazon-freertos.

I also changed the debug level, but it does not show any relevant information as far I can tell.

from amazon-freertos.

taherrera avatar taherrera commented on July 18, 2024

Ok so I think It is solved. The issue was that NetworkContext_t was being deleted in the stack because I did not declare it as a static variable in a function call.

Thanks for the help !

from amazon-freertos.

taherrera avatar taherrera commented on July 18, 2024

Still I would like to know how to set configCHECK_FOR_STACK_OVERFLOW, it could be in handy for some use latter.

from amazon-freertos.

n9wxu avatar n9wxu commented on July 18, 2024

It appears that you are using the ESP32 based upon the error dump you provided above. The ESP-IDF puts the kernel configuration options in the sdkconfig. This is configured according to the instructions here https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/kconfig.html

from amazon-freertos.

n9wxu avatar n9wxu commented on July 18, 2024

It appears you have resolved the original issue. Feel free to ask general configuration questions in the forums.

from amazon-freertos.

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.