Closed
Description
I have an application where post requests are made to an HTTPS server repeatedly. After several requests, generally 100-200 or so my application crashes. I have debugging enabled for SSL so I can see what is going on there. It seems to crash right after Server Hello Done(14) every time. I have also Decoded the exception. Here is my code which I have simplified as much as possible:
#include <WiFiServerSecure.h>
#include <WiFiClientSecure.h>
#include <ESP8266WiFi.h>
#include <ESP8266WiFiMulti.h>
#include <WiFiUdp.h>
#include <ESP8266WiFiType.h>
#include <ESP8266WiFiAP.h>
#include <WiFiClient.h>
#include <WiFiServer.h>
#include <ESP8266WiFiScan.h>
#include <ESP8266WiFiGeneric.h>
#include <ESP8266WiFiSTA.h>
unsigned long wifiConnectTimeout = 5000;
WiFiClientSecure client;
const char* host = "univagohealthcare.com";
int httpsPort = 443;
const char* fingerprint = "D9 B3 32 51 E5 2A 45 A7 1F 1D 93 E8 07 75 DF 7A 04 63 6E E6";
char* httpRequestContent = "POST /api/circuit_reboot_check HTTP/1.0\r\n"
"User-Agent: MatrixSSL/ 3.7.2-OPEN \r\n"
"Host: univagohealthcare.com\r\n"
"Accept: */*\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 132\r\n\r\n{\"event_type\":\"INTERVAL\",\"event_reason\":\"Check In\",\"device_id\":\"e5:a1:36:43:4f:e0\",\"ssid\":\"Travis-WiFi\",\"input\":\"open\",\"interval\":5}";
int requests = 0;
void setup() {
// put your setup code here, to run once:
WiFi.begin("Travis-WiFi", "*********");
Serial.begin(115200);
Serial.print("Connecting");
}
void loop() {
while(WiFi.status() != WL_CONNECTED){
Serial.print('.');
delay(500);
}
Serial.print("Requests: ");
Serial.println(requests);
// put your main code here, to run repeatedly:
if(WiFi.status() == WL_CONNECTED){
Serial.println("Sending request");
if(!client.connect(host, httpsPort)){
Serial.println("server connection failed");
delay(1000);
return;
}
if(!client.verify(fingerprint, host)){
Serial.println("Cannot verify Server");
delay(1000);
return;
}
client.print(httpRequestContent);
while(client.connected()){
if(client.available()){
String line = client.readStringUntil('\n');
Serial.println(line);
}
}
requests++;
}
}
Here is the decoded Exception on crash:
Decoding 31 results
0x4021952a: more_comps at crypto/bigint.c line 672
0x40219724: alloc at crypto/bigint.c line 672
0x40100980: realloc at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/umm_malloc/umm_malloc.c line 1720
0x40219a3d: regular_multiply at crypto/bigint.c line 672
0x4021a0b9: bi_square at crypto/bigint.c line 1016
0x4021a577: bi_barrett at crypto/bigint.c line 1289
0x4021a7cc: bi_mod_power at crypto/bigint.c line 1414
0x402195d0: trim at crypto/bigint.c line 672
0x4021b955: RSA_public at crypto/rsa.c line 254
: (inlined by) RSA_encrypt at crypto/rsa.c line 288
0x40216650: send_client_key_xchg at ssl/tls1_clnt.c line 409
0x40216ae5: do_clnt_handshake at ssl/tls1_clnt.c line 123
0x402144ad: DISPLAY_STATE at ssl/tls1.c line 2007
0x4020f70d: pbuf_free_LWIP2 at /local/users/gauchard/arduino/arduino_esp8266/origin/tools/sdk/lwip2/builder/lwip2-src/src/core/pbuf.c line 1306
0x40246884: sleep_reset_analog_rtcreg_8266 at ?? line ?
0x40204a58: __yield at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 57
0x40216458: do_handshake at ssl/tls1.c line 2007
: (inlined by) basic_read at ssl/tls1.c line 1483
0x40216834: do_client_connect at ssl/tls1_clnt.c line 168
0x401007ac: malloc at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/umm_malloc/umm_malloc.c line 1668
0x402031d0: SSLContext::_delete_shared_SSL(SSL_*) at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WiFi/src/WiFiClientSecure.cpp line 310 (discriminator 1)
0x402165c0: ssl_read at ssl/tls1.c line 2007
0x40203bb9: SSLContext::connect(ClientContext*, char const*, unsigned int) at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WiFi/src/WiFiClientSecure.cpp line 310 (discriminator 1)
0x402049e0: esp_yield at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 57
0x4020136f: delay at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_wiring.c line 51
0x40203e07: WiFiClientSecure::_connectSSL(char const*) at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WiFi/src/WiFiClientSecure.cpp line 310 (discriminator 1)
0x40203ead: WiFiClientSecure::connect(char const*, unsigned short) at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WiFi/src/WiFiClientSecure.cpp line 310 (discriminator 1)
0x40107478: sntp_get_current_timestamp at ?? line ?
0x40107478: sntp_get_current_timestamp at ?? line ?
0x402021e9: loop at /Users/traviselliott/Documents/Arduino/Yorktel_post_simpl_test/Yorktel_post_simpl_test.ino line 51
0x402041b0: Print::print(char const*) at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/Print.cpp line 99
0x40204a2c: loop_wrapper at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 57
0x40100a2c: cont_norm at /Users/traviselliott/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/cont.S line 109
Here is the log on the last successful transmission and the subsequent transmission after that which crashed:
Requests: 210
Sending request
State: sending Client Hello (1)
State: receiving Server Hello (2)
State: receiving Certificate (11)
=== CERTIFICATE ISSUED TO ===
Common Name (CN): univagohealthcare.com
Organization (O): <Not Part Of Certificate>
Organizational Unit (OU): Domain Control Validated
Basic Constraints: critical, CA:FALSE, pathlen:10000
Key Usage: critical, Digital Signature, Key Encipherment
Subject Alt Name: univagohealthcare.com www.univagohealthcare.com
=== CERTIFICATE ISSUED BY ===
Common Name (CN): Go Daddy Secure Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Organizational Unit (OU): http://certs.godaddy.com/repository/
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Not Before: Tue Mar 28 17:03:00 2017
Not After: Wed Mar 28 17:03:00 2018
RSA bitsize: 2048
Sig Type: SHA256
=== CERTIFICATE ISSUED TO ===
Common Name (CN): Go Daddy Secure Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Organizational Unit (OU): http://certs.godaddy.com/repository/
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Basic Constraints: critical, CA:TRUE, pathlen:10000
Key Usage: critical, Key Cert Sign, CRL Sign
=== CERTIFICATE ISSUED BY ===
Common Name (CN): Go Daddy Root Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Not Before: Tue May 3 07:00:00 2011
Not After: Sat May 3 07:00:00 2031
RSA bitsize: 2048
Sig Type: SHA256
=== CERTIFICATE ISSUED TO ===
Common Name (CN): Go Daddy Root Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Basic Constraints: critical, CA:TRUE, pathlen:10000
Key Usage: critical, Key Cert Sign, CRL Sign
=== CERTIFICATE ISSUED BY ===
Common Name (CN): <Not Part Of Certificate>
Organization (O): The Go Daddy Group, Inc.
Organizational Unit (OU): Go Daddy Class 2 Certification Authority
Country (C): US
Not Before: Wed Jan 1 07:00:00 2014
Not After: Fri May 30 07:00:00 2031
RSA bitsize: 2048
Sig Type: SHA256
=== CERTIFICATE ISSUED TO ===
Common Name (CN): <Not Part Of Certificate>
Organization (O): The Go Daddy Group, Inc.
Organizational Unit (OU): Go Daddy Class 2 Certification Authority
Country (C): US
Basic Constraints: CA:TRUE, pathlen:10000
=== CERTIFICATE ISSUED BY ===
Common Name (CN): <Not Part Of Certificate>
Organization (O): The Go Daddy Group, Inc.
Organizational Unit (OU): Go Daddy Class 2 Certification Authority
Country (C): US
Not Before: Tue Jun 29 17:06:20 2004
Not After: Thu Jun 29 17:06:20 2034
RSA bitsize: 2048
Sig Type: SHA1
State: receiving Server Hello Done (14)
State: sending Client Key Exchange (16)
State: sending Finished (16)
State: receiving Finished (16)
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Connection: close
Status: 200 OK
Cache-Control: no-cache, no-store
Strict-Transport-Security: max-age=15552000; includeSubDomains
Pragma: no-cache
X-XSS-Protection: 1; mode=block
X-Request-Id: 9db8207d-b8cc-488c-8e63-0e7a76e9463c
X-Runtime: 0.008300
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Mon, 26 Mar 2018 16:25:43 GMT
X-Powered-By: Phusion Passenger 5.1.4
Server: nginx/1.10.3 + Phusion Passenger 5.1.4
{"result":"on"}
Requests: 211
Sending request
State: sending Client Hello (1)
State: receiving Server Hello (2)
State: receiving Certificate (11)
=== CERTIFICATE ISSUED TO ===
Common Name (CN): univagohealthcare.com
Organization (O): <Not Part Of Certificate>
Organizational Unit (OU): Domain Control Validated
Basic Constraints: critical, CA:FALSE, pathlen:10000
Key Usage: critical, Digital Signature, Key Encipherment
Subject Alt Name: univagohealthcare.com www.univagohealthcare.com
=== CERTIFICATE ISSUED BY ===
Common Name (CN): Go Daddy Secure Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Organizational Unit (OU): http://certs.godaddy.com/repository/
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Not Before: Tue Mar 28 17:03:00 2017
Not After: Wed Mar 28 17:03:00 2018
RSA bitsize: 2048
Sig Type: SHA256
=== CERTIFICATE ISSUED TO ===
Common Name (CN): Go Daddy Secure Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Organizational Unit (OU): http://certs.godaddy.com/repository/
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Basic Constraints: critical, CA:TRUE, pathlen:10000
Key Usage: critical, Key Cert Sign, CRL Sign
=== CERTIFICATE ISSUED BY ===
Common Name (CN): Go Daddy Root Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Not Before: Tue May 3 07:00:00 2011
Not After: Sat May 3 07:00:00 2031
RSA bitsize: 2048
Sig Type: SHA256
=== CERTIFICATE ISSUED TO ===
Common Name (CN): Go Daddy Root Certificate Authority - G2
Organization (O): GoDaddy.com, Inc.
Location (L): Scottsdale
Country (C): US
State (ST): Arizona
Basic Constraints: critical, CA:TRUE, pathlen:10000
Key Usage: critical, Key Cert Sign, CRL Sign
=== CERTIFICATE ISSUED BY ===
Common Name (CN): <Not Part Of Certificate>
Organization (O): The Go Daddy Group, Inc.
Organizational Unit (OU): Go Daddy Class 2 Certification Authority
Country (C): US
Not Before: Wed Jan 1 07:00:00 2014
Not After: Fri May 30 07:00:00 2031
RSA bitsize: 2048
Sig Type: SHA256
=== CERTIFICATE ISSUED TO ===
Common Name (CN): <Not Part Of Certificate>
Organization (O): The Go Daddy Group, Inc.
Organizational Unit (OU): Go Daddy Class 2 Certification Authority
Country (C): US
Basic Constraints: CA:TRUE, pathlen:10000
=== CERTIFICATE ISSUED BY ===
Common Name (CN): <Not Part Of Certificate>
Organization (O): The Go Daddy Group, Inc.
Organizational Unit (OU): Go Daddy Class 2 Certification Authority
Country (C): US
Not Before: Tue Jun 29 17:06:20 2004
Not After: Thu Jun 29 17:06:20 2034
RSA bitsize: 2048
Sig Type: SHA1
State: receiving Server Hello Done (14)
Fatal exception 29(StoreProhibitedCause):
epc1=0x4020c4ea, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000004, depc=0x00000000
Exception (29):
epc1=0x4020c4ea epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000004 depc=0x00000000
ctx: cont
sp: 3fff00d0 end: 3fff05c0 offset: 01a0
>>>stack>>>
3fff0270: 00820000 00000082 3fff8ecc 4021952a
3fff0280: 00000214 3fff8f64 3fff8ecc 40219724
3fff0290: 3fff3964 00000214 3fff248c 40100980
3fff02a0: 00000114 00001900 00000320 00000043
3fff02b0: 00000040 00000082 3fff6b64 40219a3d
3fff02c0: 00800000 00000080 00000000 00000041
3fff02d0: 0002a990 0000003f 3fff80a4 00000041
3fff02e0: 3fff3544 3fff6b64 3fff80a4 3fff8a2c
3fff02f0: 3fff3a68 ffffffff 3fff8f64 4021a0b9
3fff0300: 00000040 3fff8f64 3fff6b64 3fff8f64
3fff0310: 00000040 3fff8f64 3fff6b64 4021a577
3fff0320: 3fff71cc 0000003f 6374e630 00000001
3fff0330: 3fff8f64 3fff6b44 3fff6b64 00000001
3fff0340: 00000010 3fff8f64 0000000f 4021a7cc
3fff0350: 3fff80a4 3fff4e84 0000000f 00000001
3fff0360: 00000001 3fff6d34 3fffa389 402195d0
3fff0370: 00000100 3fff9f34 3fffa387 00000000
3fff0380: 00000100 3fff9f34 3fffa387 4021b955
3fff0390: 3fff03c0 00000000 000000d0 00000030
3fff03a0: 293ae808 3fff6d40 000012bb 00000004
3fff03b0: 3fffa381 3fff1c9c 3fffa381 40216650
3fff03c0: 1fca0303 3dd42a56 d1183edf 48fa3deb
3fff03d0: 31142dc3 bc264dac c3e9927e e8119120
3fff03e0: c36932a3 881d00b1 0b050cc2 e8081f8a
3fff03f0: 3fffa381 00000004 3fff1c9c 40216ae5
3fff0400: 3fff0420 3fff0420 00000004 402144ad
3fff0410: 3ffe91fc 00000017 3fffa224 4020f70d
3fff0420: 3fff0440 3fff0458 40246884 00000000
3fff0430: 00000026 00000090 00000064 40204a58
3fff0440: 76726553 48207265 6f6c6c65 00000004
3fff0450: 3fffa381 00000004 3fff1c9c 00000004
3fff0460: 3fffa381 00000004 3fff1c9c 40216458
3fff0470: 6612ec57 000009df 3ffef548 0000002c
3fff0480: 00000061 3fffa381 3fff1c9c 40216834
3fff0490: 00000015 3fffa3b4 00000200 401007ac
3fff04a0: 3fff04f8 0000000e 00000010 3fff9e5c
3fff04b0: 402031d0 3fff1c9c 00000020 01000000
3fff04c0: 3fff04f8 0073cde5 3fff1c9c 402165c0
3fff04d0: 3fff1c9c 3fff5a8c 3fff9e5c 3fff9e5c
3fff04e0: 3fff9984 0073cde5 3fff176c 40203bb9
3fff04f0: 3fff1c9c 3fff5a8c 402049e0 3ffef5a0
3fff0500: 00003a98 00003a98 00003a98 4020136f
3fff0510: 3ffef304 00000000 3fff9984 3ffef568
3fff0520: 000001bb 3ffe8b8e 3ffef304 40203e07
3fff0530: 000001bb 3ffef304 3ffe8b8e 3ffef568
3fff0540: 000001bb 3ffef304 3ffe8b8e 40203ead
3fff0550: 40107478 6200bcc0 40107478 6200bcc0
3fff0560: 3ffef300 3ffef324 3ffef568 402021e9
3fff0570: 00000000 00000000 00000000 feefeffe
3fff0580: 3ffef304 0000001c 3ffef568 402041b0
3fff0590: 00000000 00000000 00000001 3ffef594
3fff05a0: 3fffdad0 00000000 3ffef58c 40204a2c
3fff05b0: feefeffe feefeffe 3ffef5a0 40100a2c
<<<stack<<<
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
ets Jan 8 2013,rst cause:4, boot mode:(1,6)
wdt reset
Any insight into the possible causes of these crashes would be greatly appreciated. I just cannot imagine what is causing these crashes.
Metadata
Metadata
Assignees
Labels
No labels