-
Notifications
You must be signed in to change notification settings - Fork 96
BSSL:_connectSSL: OOM error with Wemos D1 Mini (ESP8266) and InfluxDB 2.1.1 #170
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
As ESP8266 has a little free memory for the app (~40KB), successful communication over TLS highly depends on the rest of the application jobs. How much memory and max bock allocation is available before writing?
To know whether MFLN works with your server, please, enable library debug as written here. |
Thanks for the quick guidance. Please see below the output after adding these settings.
Memory output after the first run (above). |
Thanks, for the info. I've just remembered that the MFLN part is moved elsewhere. Please, enable debug the same way also in I've found your issue in AirGradient-InfluxDB. If you use TSL on the InfluxDB OSS server, you need more RAM on the device, which is expected, to answer your original question. Hint: If you don't write to InfluxDB Cloud, remove the last parameter of calling InfluxDBClient constructor on the line around 99, this will save you some memory. If you don't manage to update the app to release enough memory, you have several options:
|
Thanks for the additional guidance. I didn't realize that Telegraf could be used directly as an InfluxDB proxy. It was pretty quick to setup the InfluxDB V2 Listener Input Plugin, which is now working fine with the library through HTTP. :) As an aside, I did do a test with your recommended settings. This confirmed that there was no MFLN support, but threw another error (I do have Output:
|
So, Telegraf is able to successfully write to your server, ok? |
Yes, Telegraf is working fine. It's generally the main method of how I'm getting most of my data into InfluxDB anyway, but I didn't know it was able to proxy InfluxDB data directly, I've learned something new. :) I did try the things you've suggested and found that I would likely be running into low memory issues, no matter what. validateConnection() works and it is able to connect successfully, however it leaves the memory well below 30k once it ran. client.setHTTPOptions(HTTPOptions().httpReadTimeout(20000)); might be the solution, given the timeout message from BSSL, if not for the fact that adding this single line drops available memory from ~32k to ~24k, thereby leading to OOM situation again: Thanks for your help and guidance. |
Successful secured connection takes, as you noticed, around 10K. And, you should set the client to reuse the connection to avoid reconnections. Anyway, great it works for you the way it is best for you. |
Wait, so you're saying that the connection only requires around 10k? So why would Hmm, I'll guess it may be worth looking into this some more, even just so I can get a better understanding of how things work here. :) |
I found where I went wrong before. I didn't realize that the order in which With these settings in the right order, The actual db write attempt still doesn't work though, for some reason. Starting memory without DB write output:
After this first run the second DB write run in the loop will end in an OOM exception, no doubt due to the extremely low memory state at that point. One difference between the successful client.validateConnection() and unsuccessful DB write attempts that I can see in the output and that could be interesting is that in the successful case there are four BSSL:CERT entries in the attempt, while the unsuccessful one stops after the first:
vs unsuccessful:
What I find curious is where this timeout happens: right after the first cert segment was processed. |
I meant that after a secured connection is established, memory is about ~10K lower, than it started, because of buffers allocated by WiFiClient. Yes, Regarding timeout, I've almost forgotten about hard-coded connection timeout in the secure wifi client, which is 15s and cannot be changed. I'm sorry for the misleading hint. The core problem you are experiencing is in communication between secure wifi client and server. I don't know why, yet. It is on the SDK code, not in this library. I would suggest trying the SecureWrite example from this library to test the most simple app for writing to InfluxDB, where there is as much as possible RAM. |
Ah, ok, thanks for the explanation regarding memory requirements. I'll see if I can test the SecureWrite example later today. I probably won't be able to progress further for about two weeks due to travel. |
I've just tested the SecureWrite example.
|
Thanks for the test. What is the first row about memory? Line There must be a problem in the app you have. |
Thanks for the explanation. First run:
Second run:
I see now what you meant by about 30k being needed for the buffer to be allocated initially. This may certainly be app related. Unfortunately I'm not at a level when it comes to Arduino or coding in general that I could properly troubleshoot the situation or optimize memory usage. Btw, I did test WriteSecure with
Subsequent runs were the same as before, with the default false setting:
Relatedly, this option is currently referenced incorrectly in the readme as "reuseConnection", while it is actually the other way around, "connectionReuse". |
Well, I don't know details about the internal work of the secured wifi client, especially about the closed source of TLS layer. I suppose that along with caching server certificate info and some other stuff, there is another buffer kept for sending data (encrypting) data.
I recommend trying to keep only SHT3x sensor in the AirQuality app to test this.
Thanks for noticing this and reporting it! |
Hi, I'm getting this OOM error when trying to send data to InfluxDB.
Based on the description of this feature I'm just looking for a quick confirmation whether this is the expected behavior in my setup and whether my only options currently are using a reverse proxy or setting up the db without ssl.
Logs (sensitive parts substituted):
The text was updated successfully, but these errors were encountered: