Skip to content

SSL Handshake still an issue #1260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danyg opened this issue Mar 25, 2018 · 3 comments
Closed

SSL Handshake still an issue #1260

danyg opened this issue Mar 25, 2018 · 3 comments
Labels
Status: Stale Issue is stale stage (outdated/stuck)

Comments

@danyg
Copy link

danyg commented Mar 25, 2018

Hardware:

Board: DOIT ESP32 Devkit v1
Core Installation/update date: 25/nov/2017
IDE name: Platform.io
Flash Frequency: 40Mhz
Upload Speed: 115200

Description:

Reboot when trying to perform ssl handshake calling through https using HTTPClient.h
I've checked #211 and apparently platform.io download a version of the core newer than that fix, so it should have it.

This project will call an NTP first then https://timezoneapi.io/api/ip, I've tried to remove the NTP call just in case it let something broken in the environment, but it did nothing, still failing.
Also I've tried using the different certificates in the certificates chain of https://timezoneapi.io/ and also send a empty string for the certificate, it always explode like this.
Is not a blocker to me as timezoneapi.io also provides an HTTP entry point. But I think it shouldn't crash like this.

Hope this helps.

Sketch:

check https://github.com/danyg/PersianBlinds/tree/SSL_ERROR

the issue is caused in the file src/Time.cpp:93

Debug Messages:

------[ FIRST EXECUTION ]------------------------------------------------------

[V][HTTPClient.cpp:140] beginInternal(): url: https://timezoneapi.io/api/ip
[D][HTTPClient.cpp:181] beginInternal(): host: timezoneapi.io port: 443 url: /api/ip
[V][ssl_client.cpp:48] start_ssl_client(): Free heap before TLS 148436
[V][ssl_client.cpp:50] start_ssl_client(): Starting socket
[V][ssl_client.cpp:86] start_ssl_client(): Seeding the random number generator
[V][ssl_client.cpp:95] start_ssl_client(): Setting up the SSL/TLS structure...
[V][ssl_client.cpp:108] start_ssl_client(): Loading CA cert
[V][ssl_client.cpp:143] start_ssl_client(): Setting hostname for TLS session...
[V][ssl_client.cpp:158] start_ssl_client(): Performing the SSL/TLS handshake...
CORRUPT HEAP: multi_heap.c:173 detected at 0x3ffcf134
abort() was called at PC 0x40087306 on core 0

Backtrace: 0x40087f44:0x3ffd2f20 0x40088043:0x3ffd2f40 0x40087306:0x3ffd2f60 0x400877fd:0x3ffd2f80 0x40087c5e:0x3ffd2fa0 0x40083c7a:0x3ffd2fc0 0x40084205:0x3ffd2fe0 0x4000bec7:0x3ffd3000 0x400f21c9:0x3ffd3020 0x400ec5cc:0x3ffd3040


------[ SECOND EXECUTION ]------------------------------------------------------
[V][HTTPClient.cpp:140] beginInternal(): url: https://timezoneapi.io/api/ip
[D][HTTPClient.cpp:181] beginInternal(): host: timezoneapi.io port: 443 url: /api/ip
[V][ssl_client.cpp:48] start_ssl_client(): Free heap before TLS 148440
[V][ssl_client.cpp:50] start_ssl_client(): Starting socket
[V][ssl_client.cpp:86] start_ssl_client(): Seeding the random number generator
[V][ssl_client.cpp:95] start_ssl_client(): Setting up the SSL/TLS structure...
[V][ssl_client.cpp:108] start_ssl_client(): Loading CA cert
[V][ssl_client.cpp:143] start_ssl_client(): Setting hostname for TLS session...
[V][ssl_client.cpp:158] start_ssl_client(): Performing the SSL/TLS handshake...
Guru Meditation Error: Core  1 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (loopTask)
Register dump:
PC      : 0x400815b0  PS      : 0x00060636  A0      : 0x3ffcf280  A1      : 0x3ffcf1c0
A2      : 0x3ffcf36c  A3      : 0x3ffdf490  A4      : 0x00000004  A5      : 0x3ffdd7a4
A6      : 0x00000001  A7      : 0x00000000  A8      : 0x00000001  A9      : 0x00000081
A10     : 0x00000040  A11     : 0x3ffcf274  A12     : 0x3ffdf490  A13     : 0x3ffdd790
A14     : 0x3ffdec8f  A15     : 0x00000020  SAR     : 0x00000008  EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0xffffffff

Backtrace: 0x400815b0:0x3ffcf1c0 0x3ffcf27d:0x3ffcf2a0 0x4013812b:0x3ffcf320 0x401382bb:0x3ffcf340 0x4012e7d0:0x3ffcf9b0 0x4012f765:0x3ffcf9e0 0x4012fa25:0x3ffcfe30 0x4012d3bb:0x3ffcfe60 0x4012d0ff:0x3ffcfe90 0x4012d273:0x3ffcfeb0 0x40136532:0x3ffcfef0 0x401367e1:0x3ffcffa0


------[ THIRD EXECUTION ]------------------------------------------------------
[V][HTTPClient.cpp:140] beginInternal(): url: https://timezoneapi.io/api/ip
[D][HTTPClient.cpp:181] beginInternal(): host: timezoneapi.io port: 443 url: /api/ip
[V][ssl_client.cpp:48] start_ssl_client(): Free heap before TLS 148584
[V][ssl_client.cpp:50] start_ssl_client(): Starting socket
[V][ssl_client.cpp:86] start_ssl_client(): Seeding the random number generator
[V][ssl_client.cpp:95] start_ssl_client(): Setting up the SSL/TLS structure...
[V][ssl_client.cpp:108] start_ssl_client(): Loading CA cert
[V][ssl_client.cpp:143] start_ssl_client(): Setting hostname for TLS session...
[V][ssl_client.cpp:158] start_ssl_client(): Performing the SSL/TLS handshake...
Guru Meditation Error: Core  1 panic'ed (Unhandled debug exception)
Debug exception reason: Stack canary watchpoint triggered (loopTask)
Register dump:
PC      : 0x40087b6b  PS      : 0x00060836  A0      : 0x80087c1c  A1      : 0x3ffcf120
A2      : 0x3ffdf84c  A3      : 0xbaad5678  A4      : 0x3ffdf840  A5      : 0x00000000
A6      : 0x3f4148a4  A7      : 0x00000060  A8      : 0x3ffdfa58  A9      : 0x3ffdf844
A10     : 0x00000001  A11     : 0x3ffdfff9  A12     : 0x000005e8  A13     : 0x3ffddbe0
A14     : 0x000007b4  A15     : 0x00000000  SAR     : 0x00000008  EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000  LBEG    : 0x4000c2e0  LEND    : 0x4000c2f6  LCOUNT  : 0x00000000

Backtrace: 0x40087b6b:0x3ffcf120 0x40087c19:0x3ffcf150 0x40083b90:0x3ffcf170 0x40083bc1:0x3ffcf190 0x40084229:0x3ffcf1b0 0x4000bef5:0x3ffcf1d0 0x40137255:0x3ffcf1f0 0x40137e1d:0x3ffcf210 0x4013812b:0x3ffcf290 0x401382bb:0x3ffcf2b0 0x4012e7d0:0x3ffcf920 0x4012f765:0x3ffcf950
@copercini
Copy link
Contributor

Debug exception reason: Stack canary watchpoint triggered (loopTask)

out of stack in loopTask

It's really recommended to distribute your code creating more FreeRTOS tasks, but a temporary fix increases the loopTask stack here from 8192 to a larger number, but consider use more than one task for everything

@stale
Copy link

stale bot commented Aug 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Status: Stale Issue is stale stage (outdated/stuck) label Aug 1, 2019
@stale
Copy link

stale bot commented Aug 15, 2019

This stale issue has been automatically closed. Thank you for your contributions.

@stale stale bot closed this as completed Aug 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Issue is stale stage (outdated/stuck)
Projects
None yet
Development

No branches or pull requests

2 participants