mp-se / gravitymon

iSpindle replacement firmware for beer brewing/fermenting
MIT License
55 stars 11 forks source link

Sending to targets triggers exception #191

Open mburgess00 opened 1 week ago

mburgess00 commented 1 week ago

Describe the bug Exception happens after movement detected. MQTT for Home Assistant and HTTP for Brewfather configured.

To Reproduce Steps to reproduce the behavior:

  1. Have gravitymon on
  2. Move gravitymon to trigger movement detected

Expected behavior Send data to targets

Screenshots Here is the serial trace while this happens: (500) 129 1757 5254. 70260 I: GYRO: Movement detected (500) 3747 2674 3409. 70575 I: WEB : webServer callback for /api/ping. 71270 I: GYRO: Movement detected (500) 542 817 190. 72787 I: Main: Sending data to all defined push targets. 72789 I: PUSH: Free-heap 25 kb, Heap-rag 10 %, Max-block 22 kb Stack=320 b. 72809 I: PUSH: Template loaded from disk /http-1.tpl. 72810 I: TPL : Buffer needed 255. 72811 I: TPL : Transformed template 290 chars to 255 chars 72813 I: PUSH: Sending values to HTTP post 72817 I: PUSH: Adding header 'Content-Type': 'application/json' 73601 I: PUSH: HTTP post successful, response=200 73613 I: PUSH: Template loaded from disk /mqtt.tpl. 73616 I: TPL : Buffer needed 1342. 73623 I: TPL : Transformed template 1336 chars to 1342 chars 73623 I: PUSH: Sending values to mqtt.

                                                                                                                 --------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

Exception (4): epc1=0x401004d8 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

Software:

Additional context Manual test of targets works.

mp-se commented 1 week ago

Do you have more of the text after Soft WDT reset so I can pinpoint the exact location of the crash? I tried your setup but I could not replicate the crash on my device.

mburgess00 commented 1 week ago

Here's the whole stack trace:

                          --------------- CUT HERE FOR EXCEPTION DECODER ---------------

Soft WDT reset

Exception (4): epc1=0x401060f7 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

stack>>>

ctx: cont sp: 3ffff3b0 end: 3fffffd0 offset: 0160 3ffff510: 00000000 0004ad8d 7ba5e353 0568ab96
3ffff520: 3ffff570 4021439c 00000034 0004ad8d
3ffff530: 00001388 3fff6224 3ffffae0 40214492
3ffff540: 3fff449c 3ffe8368 40237944 40237934
3ffff550: fffffffc 3fff08d4 3fff08c0 3ffff600
3ffff560: 0000075b 4021439c 3ffffae0 40213b28
3ffff570: 40238760 08bc10ac 40238760 08bc10ac
3ffff580: 3fff241c 3fff22d4 3ffff600 402377a6
3ffff590: 3fff22bc 3fff22d4 00000000 40230a10
3ffff5a0: 00000000 0004ad8c 2353f7ce 3fff22a4
3ffff5b0: 0000000d 4023ba1c 00000020 40101124
3ffff5c0: 3ffffa7c 3ffff67c 0000000d 4022f4ea
3ffff5d0: 3fff2194 3fff22a4 3ffe8368 4023ba1c
3ffff5e0: 3fff22a4 0000075b 3ffff600 00000001
3ffff5f0: 3ffffa7c 0000075b 3ffffae0 4022353b
3ffff600: 00000200 00000200 3fff5da4 3fff78bc
3ffff610: 0001000a 00002710 00000000 3ffffae0
3ffff620: 3fff241c 40238760 00000000 0000075b
3ffff630: 00000000 00000000 00000000 00000000
3ffff640: 40237494 3ffff67c 00000000 3fff08c0
3ffff650: 00000001 3ffff67c 00000000 4022b314
3ffff660: 3ffffae0 0004ad8c 00000000 00000000
3ffff670: 0004ad8c 00000000 00000000 00000001
3ffff680: 00000000 00000000 00000200 00000200
3ffff690: 3fff78bc 3fff5da4 402304f4 3ffff634
3ffff6a0: 3ffff660 40230660 40237760 3ffff664
3ffff6b0: 3ffff670 40230634 402305fc 00000000
3ffff6c0: 00000000 0000e600 00000000 00000000
3ffff6d0: 00000000 00000000 00000025 40212c6f
3ffff6e0: 3ffff740 3ffff720 00000018 402be6d9
3ffff6f0: 40237494 3ffe8cfb 3fff08c0 3ffffa68
3ffff700: 3fff22bc 3ffffbe0 3fff22d4 40101124
3ffff710: 3fff6e1c 00000540 3ffffa7c 4022c96e
3ffff720: 00000000 00000536 00000536 3fff22bc
3ffff730: 0000075b 3fff22a4 3ffffae0 40223718
3ffff740: 3ffffa7c 0000053e 3ffffa7c 4022ca03
3ffff750: 3ffffa7c 0000053e 3ffffa7c 3ffffa68
3ffff760: 3ffffa7c 3ffffae0 3ffff780 4020e227
3ffff770: 43990000 4080d75f 3ffeec00 40201250
3ffff780: 646d7b24 007d736e 07000000 3fff2404
3ffff790: 000b000f 80000000 64697b24 0000007d
3ffff7a0: 05000000 38663036 40006366 06000000
3ffff7b0: 6f747b24 7d6e656b 08000000 00000000
3ffff7c0: 7f97b01a 00000000 6f747b24 326e656b
3ffff7d0: 0900007d 00000000 00000000 00000000
3ffff7e0: 65747b24 007d706d 07000000 352e3732
3ffff7f0: 00000030 05000000 65747b24 632d706d
3ffff800: 0900007d 352e3732 00000030 05000000
3ffff810: 65747b24 662d706d 0900007d 352e3138
3ffff820: 3fff0030 05000000 3fff2434 000c000f
3ffff830: 80000000 00000043 00003000 01000000
3ffff840: 61627b24 72657474 0a007d79 33302e34
3ffff850: 3ffff900 04000000 3fff4474 0011001f
3ffff860: 80000000 00303033 4023b049 03000000
3ffff870: 3fff3f44 0012001f 80000000 00003038
3ffff880: 4023f8b4 02000000 3fff4424 000b000f
3ffff890: 80000000 2e363033 3f003030 06000000
3ffff8a0: 73727b24 007d6973 07000000 0039352d
3ffff8b0: 00000006 03000000 69747b24 007d746c
3ffff8c0: 07000000 322e3838 3f003333 06000000
3ffff8d0: 6e617b24 7d656c67 08000000 322e3838
3ffff8e0: 00003333 06000000 72677b24 74697661
3ffff8f0: 0a007d79 30302e30 3ffff900 04000000 < 3ffff900: 3fff443c 000f000f 80000000 30302e30
3ffff910: 00000000 04000000 3fff4454 000d000f
3ffff920: 80000000 30302e30 3f003030 06000000
3ffff930: 3fff3fbc 0010001f 80000000 30302e30
3ffff940: 00373200 04000000 3fff3fe4 0012001f
3ffff950: 80000000 30302e30 00003030 06000000
3ffff960: 3fff400c 0015001f 80000000 30302e30
3ffff970: 3ffffa00 04000000 3fff3f6c 000f000f
3ffff980: 80000000 00000050 3ffe8660 01000000
3ffff990: 70617b24 65762d70 0a007d72 2e302e32
3ffff9a0: 00000030 05000000 3fff2b34 000c000f
3ffff9b0: 80000000 61746562 0000322d 06000000
3ffff9c0: 00000000 0000000b 00000000 00000000
3ffff9d0: 00000000 00000000 00000000 00000028
3ffff9e0: 00000000 00000000 4022df4e 00000000
3ffff9f0: 00000000 00000028 00000000 00000000
3ffffa00: 3fff08ea 00000000 00000000 3fff434c
3ffffa10: 00000000 00000000 00000020 00000000
3ffffa20: 00000000 00000020 00000000 00000000
3ffffa30: 00000000 00000000 00000000 4023709c
3ffffa40: 00000000 00000000 00000000 00000000
3ffffa50: 2e302020 00003030 00000000 00000000
3ffffa60: 00000000 3fff6e1c 00000000 00000000
3ffffa70: 00000000 00000000 00000000 3fff7374
3ffffa80: 053e053f 80000000 3fff68d4 0538053f
3ffffa90: 80000000 00000000 3ffffae0 4020d558
3ffffaa0: 00000000 00000000 41dc0000 43990000
3ffffab0: 00000000 00000000 00000000 41dc0000
3ffffac0: 00000000 3fff09f0 3ffffae0 4020d129
3ffffad0: 3ffeb21c 40101f3e 04000000 00000030
3ffffae0: 40237edc 00000000 00001388 00000000
3ffffaf0: 00000000 00000000 3fff6224 00000000
3ffffb00: 40237d10 00000000 00001388 00300ec0
3ffffb10: 00000000 3ffffae0 00000000 3fff434c
3ffffb20: 3fff434c 3fff2af4 3fff3f84 3fff61d4
3ffffb30: 0012001f 80000000 3f010050 40002710
3ffffb40: 3fff61fc 001b001f 80000000 70747468
3ffffb50: 00000000 04000000 3fff6344 0000003f
3ffffb60: 80000000 00000000 00000040 00000000
3ffffb70: 3fff2b0c 0011001f 80000000 00000000
3ffffb80: 00000000 00000000 ffffffff 00300f01
3ffffb90: 00000000 0000000a 00000000 4022a5ad
3ffffba0: 00000000 00000000 00000000 00000000
3ffffbb0: 00000000 00000000 00000000 40010000
3ffffbc0: 00001388 00000000 3fff20f4 00000000
3ffffbd0: 00000000 400041bc 00000000 00000000
3ffffbe0: 00000100 00000000 00000000 00300f00
3ffffbf0: 00000000 3fff23dc 0011001f 80000000
3ffffc00: 00000000 00000000 00000000 ffffffff
3ffffc10: 3ffffd00 00000000 3fff000a 00000000
3ffffc20: 00000000 00000000 00000000 00000000
3ffffc30: 00000000 40004200 3fff09fc 3fff09f0
3ffffc40: 3fff638c 0538053f 80000000 00300f40
3ffffc50: 00000005 00000000 00000020 40100500
3ffffc60: 00000040 00e8a101 00000005 401025f4
3ffffc70: 3ffeb215 4010588b 3ffeeca0 40100500
3ffffc80: 4010317f 3ffeeca0 00000020 40100500
3ffffc90: ffffffb9 1234bd74 3ffef570 4010335c
3ffffca0: 3ffebac0 00000000 00000000 401025f4
3ffffcb0: ffffffb9 1234bd74 40103816 00000100
3ffffcc0: 3ffebac0 7fffffff 00002200 00000001
3ffffcd0: 00000001 00000080 00000000 00000100
3ffffce0: 00000000 00000000 0000001f 40100500
3ffffcf0: 3ffeba9c 2c9f0300 3fffc228 40106125
3ffffd00: 4000050c 00000000 00000020 40100500
3ffffd10: 4022e94f 00000030 0000001e ffffffff
3ffffd20: 4022ebcc 00000019 00061a7f e5dc9bf0
3ffffd30: 01999999 60000318 c0035004 fffffffe
3ffffd40: 4022ecdc 3fffc6fc 00000000 00b71b00
3ffffd50: e5dc9bf3 000249f0 3fff1188 00000030
3ffffd60: ffffffb8 1234f948 40103816 00000100
3ffffd70: 3ffeba9c 7fffffff 00002200 00000001
3ffffd80: 00000001 00004208 3fffc228 40106125
3ffffd90: 3ffeba9c 3fffc6fc 00000000 1234f948
3ffffda0: 3ffebacc 2c9f0300 4000050c 3fffc278
3ffffdb0: 40103538 3fffc200 00000022 00000000
3ffffdc0: 40227f84 00000030 00000010 ffffffff
3ffffdd0: 40228d5e 3fff0ddc 40227f84 3fff0858
3ffffde0: 0000000e 00000000 c0035004 3fff0898
3ffffdf0: 00000000 3fffc6fc 00000000 00000007
3ffffe00: 0000000e 00000000 3fff0ddc 00000030
3ffffe10: 4000050c 3ffffec0 3fff1e94 40205125
3ffffe20: 40002eee 00000030 00000020 00000001
3ffffe30: 3fff1188 00000001 3fff1188 4022eb65
3ffffe40: 3fff1188 00000000 000000dc 00000001
3ffffe50: 3fff1188 00000001 3fff1188 4022eb65
3ffffe60: 3fff1188 00000000 00000076 00000001
3ffffe70: 60000314 00000001 3fff1188 4022ead5
3ffffe80: 00000001 3fff0e89 3fff1188 4022ed59
3ffffe90: 00000000 3fff0dfd 00000002 4022ee09
3ffffea0: 00000001 00000068 00000000 3fff0ddc
3ffffeb0: 00000000 0004a948 374bc6a7 0563bb7f
3ffffec0: 00000000 00000002 00000000 3fff0ddc
3ffffed0: 00000002 00000002 00000002 40228da6
3ffffee0: 000003e8 0004a948 00000068 00000041
3ffffef0: 3fff0858 3fff089e 3fff0850 4022822c
3fffff00: 40105fe5 05b10f3e 3fcb851f 3fff0896
3fffff10: 40106092 3ffeb024 05b10f3e 00000000
3fffff20: 40106269 05b10f3e 3fff1114 00000000
3fffff30: 3fff03e0 3fff1114 3ffe865c 3fff1114
3fffff40: 3fff0900 0004a9c3 96872b02 05644a26
3fffff50: 0004a9c2 3fff1114 00000001 00000001
3fffff60: 42b07775 00000000 00000000 40340000
3fffff70: 00000000 403b8000 a0000000 40560eee
3fffff80: 00000000 40044210 3fff0878 3fff113c
3fffff90: 3fffdad0 00000000 3fff08b8 4020d333
3fffffa0: 3fffdad0 00000000 3fff08a8 4020d3b3
3fffffb0: 00000000 00000000 3fff1110 4022e0dc
3fffffc0: feefeffe feefeffe 3fffdab0 40100459
<<<stack<<<

--------------- CUT HERE FOR EXCEPTION DECODER ---------------

I did figure out this was with the "home assistant 2" profile, with the "home assistant" profile I don't see this.

mp-se commented 1 week ago

Are you using SSL with the MQTT connection ?

It looks like there is some kind of timeout and the watchdog does a reset of the device so I don't think its a software bug rather some kind of timeout or memory issue.

If I remember correctly you are using the template that will also create the sensors and this would probably be an issue if SSL is enabled and the device is running in config mode.

mburgess00 commented 1 week ago

I don't think I had SSL enabled as I saw that an 8266 wouldn't have enough memory to handle that. Either way I'm fine with just the home assistant profile.

mp-se commented 1 week ago

It looks like the watchdog comes from not properly handling a webserver request so its not connected to the push function, but I have not found why this happends.