h2zero / NimBLE-Arduino

A fork of the NimBLE library structured for compilation with Arduino, for use with ESP32, nRF5x.
https://h2zero.github.io/NimBLE-Arduino/
Apache License 2.0
670 stars 138 forks source link

Stack canary watchpoint triggered (ipc0) when constantly notifying. #619

Closed JoshPlayer1 closed 6 months ago

JoshPlayer1 commented 6 months ago

Apologies as I don't code often. I have a project where I'm sending a lot of notifications at around 60-500 notifications per second with an ESP32-S3.

After about 2 minutes of notifying I get this error: Guru Meditation Error: Core 0 panic'ed (Unhandled debug exception). Debug exception reason: Stack canary watchpoint triggered (ipc0)

the only difference in code on whether my program crashes is the inclusion of the following two lines in the main loop() function: pChar->setValue(Data); pChar->notify(true);

Could I get insight as to why this error is happening and if I should be structuring my code differently so I don't use so much stack memory?

JoshPlayer1 commented 6 months ago

After reading some more such as the usage tips in the docs folder and adding a vTaskDelay as a work around for the assert failed: static int NimBLECharacteristic::handleGapEvent(uint16_t, uint16_t, ble_gatt_access_ctxt*, void*) NimBLECharacteristic.cpp:277 (rc == 0).

h2zero commented 6 months ago

You are sending notifications faster than BLE is designed to do. 100 per second or less would be most managable.