-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Abort called ctx: bearssl #5815
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
Comments
I had exactly the same problem. If you decode your stack then you would find your running out of heap (allocation failure) in bearssl processing the cert file data. I've gone back to either supplying the correct cert directly or setting "insecure" depending on my use case. Ideally I'd love to be able to supply a cert bundle but the way its currently implemented there is not enough free heap. |
@liebman And solution is store in certs.ar only my site CA cert(IdenTrust’s DST Root CA X3 for LetsEncrypt SSL)? |
My current usage does not require security so I'm setting insecure currently. :-( I think one of the examples show how to work with a single cert (and not use certs.ar at all). |
Set debug OOM and debug port to confirm. |
For a single SSL connection, there is no need for a certstore. Just take the single root CA and add it as a trust anchor and you're all set with much less code, faster runtime, and less memory demands. That said, this does not look to be a stack overflow because there is >5000 bytes allocated for the BSSL context and your dump shows only ~1100 bytes used. So the OOM debug suggestion would be a good starting point, after getting a decode, of course. |
@earlephilhower Im add only 2 certs from Lets Encrypt, but get same error.
|
That error, by inspection, is the result of either Arduino/libraries/ESP8266WiFi/src/CertStoreBearSSL.cpp Lines 173 to 179 in ca2f31a
Please run with memory debugging enabled, I have a feeling you'll find it throwing OOM warnings right before this crash. |
Also, my suggestion was not to reduce the # of certs in the cert store (that's basically immaterial as only a single one will be read into memory anyway so 1 or 1,000 take the same heap), but doing away with the cert store completely. Just use a conn->setTrustAnchor(myx509cert) (from memory, check examples for exact format/params). |
@earlephilhower Ok, got it. Memory debugging is TLS_MEM option? With SSL + TLS_MEM + HTTP_CLIENT:
|
Don't remember exactly, but why not enable the entire lot (2nd to last item or so) just in case? |
@earlephilhower When i set all debug options - i dont get any exceptions o_O but get "connection refused" when try to update.
|
Debug mode is running out of memory, too. That's the :oom() bit that shows up everywhere. So it's pretty sure a heap problem. You could try enabling just "OOM" debugging which may use a little less extra heap and try again. But I think that if you're at the state where just using debug causes heap exhaustion, that's a big red flag...
|
Added #5819 to add in a debug message and check in CertStore for new returning |
@earlephilhower Ok, now i minimized sketch and heap, and now i get "⸮⸮fL⸮⸮⸮⸮DH�⸮" symbols and after that ESP is restarting. OOM debug enabled. |
You have some other problem with your HW or code causing that, enabling debug doesn't cause random chars to come out after boot. In any case you're obviously out of RAM and there's not much I can suggest. I didn't look at your code until just now but I see:
just for globals, and things like JSON parsers/etc. on the dynamic side. That's pushing it too far to work with the 40-50KB of heap total available (and no MMU so no way to defrag it). You may want to see if you can only do one of those at a time, to free up memory. |
@earlephilhower This is minimized sketch:
|
Unfortunately that's not what the You may have fragmentation going on where you have lots of space total, but without any contiguous, large-enough memory region to satisfy a request for ~500 bytes is what it showed before. What does OOM debug output look like with your minified sketch? Also, you've got core 2.3.0 listed as the version. That's obviously an oversight since only 2.4+ had BearSSL. Are you running git head or 2.5.0-rel? |
I updated core to 2.5 two hours ago. |
While you're reading, can you dump the all-debug output and whatever decoded crash dump you get with the sketch you just posted a couple comments back? Since we'll obviously have different certstores (I'll just run the whole-shebang one from the example) it's not fully reproducbile by anyone but you. |
@earlephilhower Get it. With many but not all options(OOM and TLS_MEM included):
Thats all. Nothing after. |
The code doesn't compile in your post. It still has a StaticJSONDocument in it. |
@earlephilhower I use ArduinoJson 6 last beta. Or you mean JSON be in heap and i go out of memory? |
JSON decoding is really bad memory-wise, can eat tons of space and fragment like mad because it makes lots of Strings. Obviously you're running something, though, so please put in full debugging (including OOM) in. You were having OOM errors before, so it only makes sense to have them enabled especially if there's JSON stuff. |
@earlephilhower Ok, now i made so simple sketch as i can:
I turn on all debug options:
|
@earlephilhower On 115200:
And reboot. |
I see one memory leak and two fishy cases that merit checks for stack corruption. Fishy cases: In addition, the original sketch shown has huge delays that don't let services, such as MDNS, work properly. Closing due to user error. |
Uh oh!
There was an error while loading. Please reload this page.
Basic Infos
Platform
Settings in IDE
Problem Description
When i use WiFiClientSecure with HTTPClient - it fails when i try send GET request on my server.
Certs stored in spiffs generating by standart tools.
MCVE Sketch
Debug Messages
The text was updated successfully, but these errors were encountered: