Open DJake42 opened 1 week ago
I too have have a very similiar project with the same URL lookup and tried swapping from the arduino framework to esp-idf and using SSL with no luck. I've rolled esphome back until this is fixed 👀
1) Until 2024.6.1 the get_string method worked fine for me on multiple ESP8266 making http requests Upgrading to 2024.6.1 forced the use of the capture_response: true and use the the "body" variable as get_string was no longer supported. I rolled out to 1 ESP8266 that communicates directly with another ESP8266 running ESPHome and imediately ran into the memory leak issue so I waited until 2024.6.2 #(5955) and the fix before continuing my roll out ro other ESPs. 2) Following the 2024.6.2 fix and when rolling out to other ESP8266 devices I have run into the "[E][http_request.arduino:132]: Stream pointer vanished!" error and the ESP8266 locks up. I have tried setting the max_response_buffer_size to a value for all HTTP requests as mentioned above but this did not solve the issue.
In summary : The inital ESP (1) is ESPHome to ESPHome and works on 2024.6.2 while the other ESPs (2) do not. The only difference is that the ESPs in (2) are using HTTP request to access a tasmota plug rather than another ESPHome device. Both devices provide a JSON response which caused no issue in 2024.5.5.
Adding reference to this comment which states.
One thing that was overlooked with the rewrite was servers sending chunked responses with no known Content-Length header. This will need more code added to handle these kind of responses.
FYI Tested everything again on 2024.6.4, still the same issue.
PR is not ready yet.:(
The problem
http_request.get
seems to be somewhat broken (at least for me) especially in combination withmax_response_buffer_size
using the
http_request.get
function withoutmax_response_buffer_size
causes the esp to hang, and then it just spams[02:38:44][E][http_request.arduino:132]: Stream pointer vanished!
until it crashesprinting out the
body
viaalso shows that there are some weird characters in the beginning:
after the get call the body should only be composed of the json at the end, no idea where the "a8" and the line brak comes from
Also
max_response_buffer_size
does not seem to work as described in the documentation, for me, the number defined formax_response_buffer_size
defines the number of characters thebody
holds, instead of the size of it in kB as mentioned in the docIf I do this:
max_response_buffer_size: 24
Instead of what I showed above, the log will show
If I put in 28 instead of 24 it will show 4 more characters and so on. Increasing the size to over around 200 will result in a crash of the esp.
(I am not a C++ dev and this is my first time opening an issue on github, sorry if I messed anything up)
Which version of ESPHome has the issue?
2024.6.1
What type of installation are you using?
Home Assistant Add-on
Which version of Home Assistant has the issue?
2024.6.3
What platform are you using?
ESP32
Board
wemos_d1_mini32
Component causing the issue
http_request
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
I have two
http_request.get
functions that do different things. Only if both of them have themax_response_buffer_size
defined the system won't run into the[02:38:44][E][http_request.arduino:132]: Stream pointer vanished!
-Error upon executing them