esphome / ESPAsyncWebServer

Async Web Server for ESP8266 and ESP32
79 stars 55 forks source link

release 3.2.0 breaks esphome web_server component #30

Open czipis opened 1 month ago

czipis commented 1 month ago

please see this issue https://github.com/esphome/issues/issues/5793

bkaufx commented 1 month ago

Specifically I think the mutex/bool for queue processing is a problem for the events server. So far ESP32 doesn't seem to be having issues, or nowhere near as significant as ESP8266.

I can help debug, but not really sure what the best way to do that is. Add debug logging around the mutex/bool?

Issue may be related to the following statement from the ESPHome documentation. "Additionally, each time a client connects to the event source the server sends out all current states so that the client can catch up with reality." That would be corroborated by anecdotal evidence that devices with more entities have worse issues with this.

bkaufx commented 1 month ago

Added a print statement and can see that when the web_server page fails to load, it is stuck in an infinite loop at this line:

  if(this->_messageQueue_processing){
    return;
  }

As soon as I close the browser page trying to load events, the loop stops. When the web page loads properly, that return never executes.

bkaufx commented 1 month ago

When the web interface fails to load properly, the message queue fills up to 32 and then stays there forever. Never goes down at all.

bkaufx commented 1 month ago

It appears as though, when the page fails to load, the _messageQueue_processing boolean is already set to true by default without the _runQueue function ever executing.

bkaufx commented 1 month ago

This PR was merged so issue should be fixed in 3.2.1. Still needs to be added into ESPHome though.

https://github.com/esphome/ESPAsyncWebServer/pull/31