I’ve made some more tests today.
I’ve started OMG and I’ve put uptime and freemem reported by OMG via mqtt on chart (with help of OpenHAB and influxdb/grafana combo). Green line represents uptime, red: freemem. Breaks in green line means gateway lost connection to mqtt broker or wifi. When green line starts from the 0 = restart.
After initial tests I discovered, that OMG is able to recover mqtt connection, but only 2-3 times and then OMG is not accessible, not responding to ping - only reset helps 
So I hookup OMG ESP32 dev board to computer and logged serial output.
- Starting log:
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2018.08.09 13:17:00 =~=~=~=~=~=~=~=~=~=~=~=
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
ets Jun 8 2016 00:22:57
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:952
load:0x40078000,len:6084
load:0x40080000,len:7936
entry 0x40080310
I (27) wifi: wifi driver task: 3ffdfb84, prio:23, stack:4096, core=0
I (118) wifi: wifi firmware version: 4fd6a2c
I (119) wifi: config NVS flash: enabled
I (121) wifi: config nano formating: disabled
I (135) wifi: Init dynamic tx buffer num: 32
I (135) wifi: Init data frame dynamic rx buffer num: 10
I (135) wifi: Init management frame dynamic rx buffer num: 10
I (139) wifi: Init static rx buffer size: 1600
I (144) wifi: Init static rx buffer num: 4
I (147) wifi: Init dynamic rx buffer num: 10
I (211) wifi: mode : sta (30:ae:a4:03:58:f0)
122: Connecting to
122: B51
I (344) wifi: n:1 1, o:1 0, ap:255 255, sta:1 1, prof:1
634: .
I (1077) wifi: state: init -> auth (b0)
I (1080) wifi: state: auth -> assoc (0)
I (1084) wifi: state: assoc -> run (10)
I (1096) wifi: connected with B51, channel 1
I (1100) wifi: pm start, type: 1
1134: .
1134: WiFi ok with manual config credentials
1134: OpenMQTTGateway mac:
1134: 30:AE:A4:03:58:F0
1134: OpenMQTTGateway ip:
1134: 2986453184
1139: 1883
1139: Connecting to MQTT by IP adress
1140: 192.168.1.1
2642: ZgatewayBT multicore ESP32 setup done
2642: BT Task running on core 0
5001: MQTT connection...
5010: Connected to broker
5012: Subscription OK to the subjects
18240: Get ManufacturerData
18240: u
18242: Get RSSI
18242: B51/OMG/BT/6827377DB72A/rssi -84
18278: Get RSSI
18278: B51/OMG/BT/3CBD3E6B6F5D/rssi -76
18396: Get ManufacturerData
18396: Ĺ•
18397: Get RSSI
18397: B51/OMG/BT/7515E591316B/rssi -83
18398: Get service data
18401: 0000000000000000000000000000000000000000
18401: Get service data UUID
18403: 0000fe9f-0000-1000-8000-00805f9b34fb
18408: Get ManufacturerData
18409:
18411: Get RSSI
18412: B51/OMG/BT/10E2ACB234AD/rssi -47
18865: Get ManufacturerData
18865: Ĺ•
18867: Get RSSI
18867: B51/OMG/BT/6606F6E27513/rssi -76
18868: Get service data
18871: 0000000000000000000000000000000000000000
18871: Get service data UUID
18872: 0000fe9f-0000-1000-8000-00805f9b34fb
19082: Get ManufacturerData
19082: Ĺ•
19083: Get RSSI
19083: B51/OMG/BT/41AC5AC8FE77/rssi -62
19084: Get service data
19087: 0000000000000000000000000000000000000000
19087: Get service data UUID
19089: 0000fe9f-0000-1000-8000-00805f9b34fb
20001: Uptime (s)
20001: 20
- First connection drop, but with “self” recovery:
1420071: Uptime (s)
1420071: 1420
1420071: Remaining memory
1420071: 17308
1420071: RSSI
1420071: -41
1420071: SSID
1420071: B51
1420071: Activated modules
1420074: BT
1429627: Get ManufacturerData
1429627:
1429629: Get RSSI
1429629: B51/OMG/BT/13CC97E2A9DB/rssi -49
1429638: Get RSSI
1429638: B51/OMG/BT/5D7F0E57DDB1/rssi -82
1429639: Get service data
1429641: 0000000000000000000000000000000000000000
1429641: Get service data UUID
1429643: 0000fe9f-0000-1000-8000-00805f9b34fb
1429672: Get ManufacturerData
1429672: u
1429673: Get RSSI
1429673: B51/OMG/BT/6827377DB72A/rssi -80
1429676: Get RSSI
1429677: B51/OMG/BT/6124C65A47C7/rssi -62
1429677: Get service data
1429680: 0000000000000000000000000000000000000000
1429682: Get service data UUID
1429686: 0000fe9f-0000-1000-8000-00805f9b34fb
1429691: Get RSSI
1429691: B51/OMG/BT/666EAA945696/rssi -65
1429696: Get service data
1429699: 0000000000000000000000000000000000000000
1429702: Get service data UUID
1429705: 0000fe9f-0000-1000-8000-00805f9b34fb
1429710: Get RSSI
1429710: B51/OMG/BT/3CBD3E6B6F5D/rssi -84
1431506: Get RSSI
1431506: B51/OMG/BT/4B6D9E87D4D6/rssi -90
1431507: Get service data
1431510: 0000000000000000000000000000000000000000
1431510: Get service data UUID
1431510: 0000fe9f-0000-1000-8000-00805f9b34fb
1435990: Get ManufacturerData
1435990: L
1435991: Get RSSI
1435991: B51/OMG/BT/4BD839E035EF/rssi -87
I (1439442) wifi: state: run -> auth (2c0)
I (1439442) wifi: pm stop, total sleep time: 646395822 us / 1438342207 us
I (1439442) wifi: n:1 0, o:1 1, ap:255 255, sta:1 1, prof:1
[W][WiFiGeneric.cpp:360] _eventCallback(): Reason: 2 - AUTH_EXPIRE
I (1143439495363)3 : wMifQiTT: cstonatnee:ct iauonth.. .->
init [E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
(01)4
39373I: (fa14il39ed46, 4)rc w=i
fi14: 39f3l7u7s:h 2t
xq
1
43I9 (1374399: 4t69ry) awigafii:n sinto 5p s
sw
txq
I (1439474) wifi: lmac stop hw txq
I (1439486) wifi: mode : sta (30:ae:a4:03:58:f0)
1439422: BT Task running on core 0
1444383: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1444383: failed, rc=
1444384: -2
1444384: try again in 5s
1449384: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1449384: failed, rc=
1449384: -2
1449384: try again in 5s
1454385: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1454385: failed, rc=
1454385: -2
1454385: try again in 5s
1459386: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1459386: failed, rc=
1459386: -2
1459386: try again in 5s
1464387: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1464387: failed, rc=
1464387: -2
1464387: try again in 5s
1464623: BT Task running on core 0
1469388: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1469388: failed, rc=
1469388: -2
1469388: try again in 5s
1474389: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1474389: failed, rc=
1474389: -2
1474389: try again in 5s
1479390: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1479390: failed, rc=
1479390: -2
1479390: try again in 5s
1484391: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1484391: failed, rc=
1484391: -2
1484391: try again in 5s
1489392: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1489392: failed, rc=
1489392: -2
1489392: try again in 5s
1489824: BT Task running on core 0
1494393: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1494393: failed, rc=
1494393: -2
1494393: try again in 5s
1499394: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1499394: failed, rc=
1499394: -2
1499394: try again in 5s
1504395: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1504395: failed, rc=
1504395: -2
1504395: try again in 5s
1509396: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1509396: failed, rc=
1509396: -2
1509396: try again in 5s
1514397: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1514397: failed, rc=
1514397: -2
1514397: try again in 5s
1515025: BT Task running on core 0
1519398: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1519398: failed, rc=
1519398: -2
1519398: try again in 5s
1524399: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1524399: failed, rc=
1524399: -2
1524399: try again in 5s
1529400: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1529400: failed, rc=
1529400: -2
1529400: try again in 5s
1534401: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1534401: failed, rc=
1534401: -2
1534401: try again in 5s
1539402: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1539402: failed, rc=
1539402: -2
1539402: try again in 5s
1540226: BT Task running on core 0
1544403: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1544403: failed, rc=
1544403: -2
1544403: try again in 5s
1549404: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1549404: failed, rc=
1549404: -2
1549404: try again in 5s
1554405: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1554405: failed, rc=
1554405: -2
1554405: try again in 5s
1559406: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1559406: failed, rc=
1559406: -2
1559407: try again in 5s
1564407: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1564407: failed, rc=
1564407: -2
1564407: try again in 5s
1565427: BT Task running on core 0
1569408: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1569408: failed, rc=
1569408: -2
1569408: try again in 5s
1574409: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1574409: failed, rc=
1574409: -2
1574409: try again in 5s
1579410: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1579410: failed, rc=
1579410: -2
1579410: try again in 5s
1584411: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1584411: failed, rc=
1584411: -2
1584411: try again in 5s
1589412: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1589412: failed, rc=
1589412: -2
1589412: try again in 5s
1590628: BT Task running on core 0
1594413: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1594413: failed, rc=
1594413: -2
1594413: try again in 5s
1599414: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1599414: failed, rc=
1599414: -2
1599414: try again in 5s
1604415: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1604415: failed, rc=
1604415: -2
1604415: try again in 5s
1609416: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1609416: failed, rc=
1609416: -2
1609416: try again in 5s
1614417: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1614417: failed, rc=
1614417: -2
1614417: try again in 5s
1615829: BT Task running on core 0
1619418: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1619418: failed, rc=
1619418: -2
1619418: try again in 5s
1624419: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1624419: failed, rc=
1624419: -2
1624419: try again in 5s
1629420: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1629420: failed, rc=
1629420: -2
1629420: try again in 5s
1634421: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1634421: failed, rc=
1634421: -2
1634421: try again in 5s
1639422: MQTT connection...
[E][WiFiClient.cpp:213] connect(): lwip_connect_r: 118
1639422: failed, rc=
1639422: -2
1639422: try again in 5s
1641030: BT Task running on core 0
1644423: failed connecting to mqtt
1644433: Connecting to
1644433: B51
I (1644690) wifi: n:1 1, o:1 0, ap:255 255, sta:1 1, prof:1
1644980: .
I (1645423) wifi: state: init -> auth (b0)
I (1645426) wifi: state: auth -> assoc (0)
I (1645431) wifi: state: assoc -> run (10)
I (1645443) wifi: connected with B51, channel 1
I (1645447) wifi: pm start, type: 1
1645480: .
1645480: WiFi ok with manual config credentials
1645480: MQTT connection...
1645498: Connected to broker
1645501: Subscription OK to the subjects
1645501: Uptime (s)
1645501: 1645
1645501: Remaining memory
1645501: 13888
1645501: RSSI
1645502: -42
1645503: SSID
1645504: B51
1645505: Activated modules
1645508: BT
1656392: Get ManufacturerData
1656392: u
1656394: Get RSSI
1656394: B51/OMG/BT/6827377DB72A/rssi -79
1656456: Get RSSI
1656456: B51/OMG/BT/55C12B47F91D/rssi -90
1656457: Get service data
1656460: 0000000000000000000000000000000000000000
1656460: Get service data UUID
1656460: 0000fe9f-0000-1000-8000-00805f9b34fb
1656594: Get RSSI
1656594: B51/OMG/BT/3CBD3E6B6F5D/rssi -78
- Final connection drop and OMG freeze:
2494489: 0000fe95-0000-1000-8000-00805f9b34fb
2494493: Processing BLE device data
2494496: mi flora data reading
2494499: rest_data
2494501: 71209800385e58658d7cc40d091002bf00
2494505: 5
2494509: 191.00
2494511: 191
2497789: Get RSSI
2497789: B51/OMG/BT/7CDBA823065C/rssi -82
2497791: Get service data
2497794: 0000000000000000000000000000000000000000
2497794: Get service data UUID
2497795: 0000fe9f-0000-1000-8000-00805f9b34fb
2497920: BT Task running on core 0
2505544: Uptime (s)
2505544: 2505
2505544: Remaining memory
2505544: 16540
2505544: RSSI
2505544: -41
2505544: SSID
2505544: B51
2505544: Activated modules
2505547: BT
2513268: Get RSSI
2513269: B51/OMG/BT/7CDBA823065C/rssi -83
2513272: Get service data
2513275: 0000000000000000000000000000000000000000
2513275: Get service data UUID
2513275: 0000fe9f-0000-1000-8000-00805f9b34fb
2513278: Get ManufacturerData
2513279:
2513282: Get RSSI
2513283: B51/OMG/BT/35F6DFE4E1D8/rssi -63
2513288: Get RSSI
2513288: B51/OMG/BT/66ABED23A7DC/rssi -62
2513292: Get service data
2513296: 0000000000000000000000000000000000000000
2513298: Get service data UUID
2513301: 0000fe9f-0000-1000-8000-00805f9b34fb
2513328: Get RSSI
2513328: B51/OMG/BT/6C596315D743/rssi -66
2513329: Get service data
2513331: 0000000000000000000000000000000000000000
2513331: Get service data UUID
2513332: 0000fe9f-0000-1000-8000-00805f9b34fb
2513441: Get ManufacturerData
2513441: u
2513442: Get RSSI
2513442: B51/OMG/BT/6827377DB72A/rssi -81
2513714: Get RSSI
2513714: B51/OMG/BT/3CBD3E6B6F5D/rssi -78
2514247: Get RSSI
2514247: B51/OMG/BT/78BCBEFEEF2C/rssi -90
2514248: Get service data
2514251: 0000000000000000000000000000000000000000
2514252: Get service data UUID
2514252: 0000fe9f-0000-1000-8000-00805f9b34fb
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: loopTask
2525545: Uptime (s)
2525545: 2525
2525545: Remaining memory
2525545: 16480
2525545: RSSI
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: IDLE
Task watchdog got triggered. The following tasks did not reset the watchdog in time:
- IDLE (CPU 0)
Tasks currently running:
CPU 0: wifi
CPU 1: IDLE
I’ve searched for last error and found related to this issue topic on espressif github repo:
There is a long interesting discussion, with a solution to add to main loop delay using vTaskDelay(10);
function.
I added it to main loop after line 663:
result:
#if defined(ESP8266) || defined(ESP32)
vTaskDelay(10);
stateMeasures();
#endif
Currently, with this modification, OMG is running for 3h35mins without connection drop. It’s too early to say that this a solution. Will report tomorrow.
BTW, I’ve enabled multicore for ESP32 in my case.