Skip to content

Connecting to a custom device is causing stack overflow crash #175

@ithinkido

Description

@ithinkido

Describe the bug
I would like to connect to the BLE service on a Pinecil v.2 soldering iron. This device has no active broadcasts, and all data has to be polled at regular intervals. As the device is not battery powerd, this is not an issue for power consumption.
I am not sure, but I suspect that this may be causing an issue with ble2mptt. After creating a base config file the ESP32 starts a constant stack overflow boot loop once it detects the Pinecil. Looking at the logs , I think it may be that the ESP is expecting some sort of active data reply , but not receiving it.

To Reproduce
I can imagine that this may be quite tough to reproduce without the device. I am using the pre-compiled v1.6 bin and starting from a fresh install with esptool.py -b 921600 --chip esp32 write_flash --erase-all 0 ble2mqtt-full.bin

My config file is reduced to a base file to simplify testing and looks like this

{
  "network": {
    "wifi": {
      "ssid": "xxxxxxxxxxx",
      "password": "xxxxxxxxxx"
    }
  },
  "mqtt": {
    "server": {
      "host": "192.168.1.200",
      "port": 1883,
      "username": "xxx",
      "password": "xxxxx"
    },
    "publish": {
      "qos": 0,
      "retain": true
    }
  },
  "ble": {
    "whitelist": [
      "xx:D7:FD:D7:83:xx" ]
   }
 }

Logs
the log for a complete reboot loop cycle :
log.txt

and and extracted form, when the issue happens :

.[0;32mI (6026) BLE2MQTT: Discovered BLE device: xx:d7:fd:d7:83:xx (RSSI: -70), connecting.[0m
.[0;32mI (7256) BLE2MQTT: Discovered BLE device: xxxxxxxxxxx(RSSI: -96), not connecting.[0m
.[0;31mE (8406) BT_APPL: char not added, no resources.[0m
.[0;31mE (8436) BT_APPL: char not added, no resources.[0m
.[0;31mE (8436) BT_APPL: char not added, no resources.[0m

***ERROR*** A stack overflow in task BTU_TASK has been detected.

Backtrace:0x4008f80a:0x3ffe47d0 0x4008ff35:0x3ffe47f0 0x400931b6:0x3ffe4810 0x40091ad8:0x3ffe4890 0x4009002c:0x3ffe48b0 0x4008ffde:0x3ffe4364 |<-CORRUPTED


ELF file SHA256: c6cc4a6af92e3f56

Additional context
Using the same setup, there is no stack overflow issue , as long as the Pinecil is not detected.

I have successfully connected to and sent control messages to the Pinecil using BLE-client on ESPhome, so I am quite sure that the communication does work.

here is a scan log for the device
Log_2023-02-14_17_40_17.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions