Azure / azure-iot-arduino

Azure IoT library for the Arduino
Other
168 stars 95 forks source link

Exception inside crypto/bigint.c #70

Closed rcarmo closed 6 years ago

rcarmo commented 6 years ago

I'm trying to get the sample going, but there seems to be a problem with the SSL negotiation, and the sketch crashes (see below). I've been able to replicate this consistently across an ESP-01 and another ESP8266 board, with all the latest Arduino libraries (it's a fresh install, done today after a first one two days ago).

I'm also very curious as to whether there is a "plain", non-async HTTPS primitive I can invoke for the single purpose of sending an individual message, rather than the full-blown sample (since besides the model management, I suspect the threading and async bits aren't necessary for 80% of applications with very simple devices).

Here's the serial output:

Attempting to connect to SSID: IoT
sta config unchangedscandone
f 0, Waiting for Wifi connection......scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 11
cnt 
..
connected with IoT, channel 4
dhcp client start...
wifi evt: 0
.ip:192.168.1.99,mask:255.255.255.0,gw:192.168.1.254
wifi evt: 3
Connected to wifi
please start sntp first !
Fetching NTP epoch time failed! Waiting 2 seconds to retry.
Thu Oct 19 15:02:27 2017

Fetched NTP epoch time is: 1508425348
IoT Hub SDK for C, version 1.1.21
IoTHubClient accepted the message for delivery
[hostByName] request IP for: river.azure-devices.net
[hostByName] Host: river.azure-devices.net IP: 13.69.192.43
:ref 1
ssl/tls1.c:545 malloc 6864, left 11848
State:  sending Client Hello (1)
:wr
:sent 52
:rn 1460
:ww
:rd 5, 1460, 0
:rdi 1460, 5
:rd 1455, 1460, 5
:rdi 1455, 1455
:c0 1455, 1460
:rn 1460
:rd 1460, 1460, 0
:rdi 1460, 1460
:c0 1460, 1460
:rn 311
:rd 311, 311, 0
:rdi 311, 311
:c0 311, 311
State:  receiving Server Hello (2)
State:  receiving Certificate (11)
crypto/bigint.c:1072 realloc 1032, left 7552
crypto/bigint.c:1072 realloc 1028, left 3528
crypto/bigint.c:1072 realloc 2056, left 1368
State:  receiving Server Hello Done (14)
crypto/bigint.c:1112 malloc 516 failed, left 624
Fatal exception 29(StoreProhibitedCause):
epc1=0x4000e1b2, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000

Exception (29):
epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3fff40d0 end: 3fff4740 offset: 01a0

>>>stack>>>
3fff4270:  3fffbfa4 ffffffff 00000010 40235cae  
3fff4280:  00000010 00000000 00000000 00000000  
3fff4290:  00400000 00000040 3fffbfbc 3fffbfdc  
3fff42a0:  3fff992c 3fff992c 00000004 00000020  
3fff42b0:  3fffbfa4 3fff992c 3fff9c64 00000020  
3fff42c0:  3fffbfa4 3fff992c 00000010 4023657d  
3fff42d0:  3fffbf84 3fff9c44 3fff9c64 00000001  
3fff42e0:  00000001 3fff9c64 3fff77ca 4023535c  
3fff42f0:  00000100 3fff99a4 3fff7797 00000000  
3fff4300:  00000100 3fff99a4 3fff7797 40237585  
3fff4310:  3fff4340 00000000 000000d0 00000030  
3fff4320:  14676f8f ba647b38 ebd1b8a3 00000004  
3fff4330:  00000004 3fff76c4 3fff7791 40233690  
3fff4340:  c9890203 569a44df 53bcbca6 d628e3f8  
3fff4350:  5b4e3d37 7ef41d90 f6ab8391 f5e92ff2  
3fff4360:  1d8a0d83 a76a07f4 3f1b6a46 6f8f433b  
3fff4370:  00000004 3fff8427 3fff76c4 40233a91  
3fff4380:  08da6efb 0dd42969 8f589ea0 76d58400  
3fff4390:  3fff43b0 3fff43b0 00000004 40231c49  
3fff43a0:  3ffe8a50 3fff8427 3fff9284 00000c00  
3fff43b0:  3ffec684 3ffece14 00000000 00000004  
3fff43c0:  3fff76c4 3fff8427 00000004 00000004  
3fff43d0:  00000004 3fff8427 3fff76c4 40233488  
3fff43e0:  00000000 3fff7791 3fff76c4 40233830  
3fff43f0:  3ffec970 3fff7584 3fff76c4 402321be  
3fff4400:  3fff4450 0000000e 00000010 00000000  
3fff4410:  3fff7584 00000000 3fff76c4 01000000  
3fff4420:  3fff4450 3fff3548 3fff76c4 402335e0  
3fff4430:  4021443c 72657669 3fff3548 00001387  
3fff4440:  00048782 3fff3548 3fff761c 40214aa9  
3fff4450:  000001bb 3fff3548 3fff748c 40213d72  
3fff4460:  2bc0450d 3fff4470 00000008 00000000  
3fff4470:  3fff744c 40213570 3fff3548 40214d50  
3fff4480:  3ffec3f0 2bc0450d 00000482 4010020c  
3fff4490:  3fff3654 3fff44f0 000001bb 40214eba  
3fff44a0:  3ffec3f0 2bc0450d 3ffec3f0 2bc0450d  
3fff44b0:  3fff3654 3fff44f0 40210fa8 4020c5f5  
3fff44c0:  3fff7404 00000000 00000000 00000000  
3fff44d0:  00000000 3fff4570 3fff6dec 3fff6e0c  
3fff44e0:  3fff7304 3fff6dd4 3fff7404 402134f2  
3fff44f0:  3fff7404 3fff71b4 0000003c 401006f0  
3fff4500:  4020c384 3fff4540 3fff7404 40211bcc  
3fff4510:  3fff7404 3fff7434 3ffeb928 40210f56  
3fff4520:  00000000 00000009 00000000 3fff6e0c  
3fff4530:  00000001 3fff66d4 3fff7264 00000051  
3fff4540:  3fff6474 000001bb 00000000 3fff6e0c  
3fff4550:  3fff7304 3fff6dd4 3fff6454 4020dcb9  
3fff4560:  3fff4630 3fff7304 3fff73ec 00000004  
3fff4570:  00000101 00000000 00000000 00000000  
3fff4580:  00000000 3ffe0000 3fff6dec 3fff6dd4  
3fff4590:  3fff73ec 00000000 00000001 00000001  
3fff45a0:  00000000 3fff66d4 00000000 3fff4630  
3fff45b0:  00000001 00000000 00000051 401008e0  
3fff45c0:  00000001 3fff7314 3fff7314 3fff6454  
3fff45d0:  00000001 3fff7314 3fff6dd4 4020e16c  
3fff45e0:  00000000 00000000 3fff3630 3fff6dd4  
3fff45f0:  3fff66d4 3fff6e0c 00000014 3fff6dd4  
3fff4600:  3fff6f74 00000051 3fff6e0c 3fff6dd4  
3fff4610:  00000000 3fff6e0c 3fff65d4 40208898  
3fff4620:  3fff4630 00000000 00000000 4020d66f  
3fff4630:  00000000 00000001 3fff703c 3fff6ffc  
3fff4640:  00000051 3fff6f74 3fff46b0 3ffec142  
3fff4650:  3fff6f0c 000001f6 3fff6404 00000001  
3fff4660:  3fff62bc 00000000 00000000 00000000  
3fff4670:  00000000 00000001 3fff6b8c 3fff6454  
3fff4680:  00000000 3fff65bc 3fff46a0 3fff6e7c  
3fff4690:  3fff62c4 3fff6f0c 3fff62bc 402062fc  
3fff46a0:  00000000 000003ab 000003ab 4010020c  
3fff46b0:  3fff62c4 00000424 00000424 4010020c  
3fff46c0:  3fff6dd4 3fff62bc 3fff7194 3fff6e7c  
3fff46d0:  3fff6dd4 3fff62bc 3fff30e8 4020141b  
3fff46e0:  3fff6d1c 3fff3710 3fff3654 40215350  
3fff46f0:  00000051 3fff719c 00000009 40215470  
3fff4700:  3fffdad0 59e8be84 3fff3654 3fff3710  
3fff4710:  3fffdad0 00000000 3fff3708 4021367c  
3fff4720:  feefeffe feefeffe 3fff3708 40215830  
3fff4730:  feefeffe feefeffe 3fff3720 40100970  
<<            
JetstreamRoySprowl commented 6 years ago

@rcarmo : 1 - We've got several samples for Arduino; which one are you working with? 2 - Version 1.0.40 of the Arduino libraries was just dropped yesterday. Could you try with the new libraries and see if the problem still exists? 3 - Arduino doesn't support threading, so the Arduino samples don't have any threading going on. 4 - We don't have any lighter-weight samples, but the IoT Hub does support simpler REST operations.

rcarmo commented 6 years ago

Thanks, but I figured out I was running out of heap space in the ESP-01 due to nested string allocations, and bigint blew up because of that.

On 26 Oct 2017, at 18:21, Roy Sprowl notifications@github.com wrote:

@rcarmo : 1 - We've got several samples for Arduino; which one are you working with? 2 - Version 1.0.40 of the Arduino libraries was just dropped yesterday. Could you try with the new libraries and see if the problem still exists? 3 - Arduino doesn't support threading, so the Arduino samples don't have any threading going on.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

JetstreamRoySprowl commented 6 years ago

Cool. I'll close this issue; feel free to re-open it if need be.