-
Notifications
You must be signed in to change notification settings - Fork 31
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
Random crashes in asyncHTTPrequest::_onDisconnect #19
Comments
I have had that problem as well. In my application, I was deleting the instance of asyncHTTPrequest after the timeout and then creating a new one for the next operation. When I stopped doing that, the problem went away. It runs for days now with no issues. I'm not inclined to try to debug this as I reached the same conclusion as you that it has to do with AsyncTCP or something below that. I had posted some questions to me-no-dev but got no response. Right now I'm mulling over changing to using the ESP-IDF client directly to try and get HTTPS. The documentation says it only runs async for HTTPS, but I can just run in a task and let it block for HTTP. The HTTPS is more important to me. I would leave this as is an just make a new client class. |
Thanks for the quick reply! The asyncHTTPrequest is a long-living one in our case. However, there are actually two instances. Unfortunately, in its current state the library is not usable for us :( We do need HTTP (rather than HTTPS) though. |
Did you end up getting https? I just came across this library and found https crashes it. |
@julienaltieri , |
Occasionally, the ESP32 crashes when trying to delete _client in asyncHTTPrequest::_onDisconnect or when trying to call asyncHTTPrequest::_onDisconnect.
The first scenario seems to happen when for some reason asyncHTTPrequest::_onDisconnect is called for the same asyncHTTPrequest instance and the same AsyncClient instance within very short time (1 or 2 ms).
It seems to happen when a connection times out.
In this scenario I get "CORRUPT HEAP: Bad head at 0x3ffdfa60. Expected 0xabba1234 got 0x3ffdfff8".
Stack trace for scenario 1:
The second scenario seems to happen when asyncHTTPrequest::_onConnect is called just before asyncHTTPrequest::_onDisconnect for the same asyncHTTPrequest instance and the same AsyncClient instance is supposed to be called.
This seems to happen when a new request is started just before the connection is timing out.
In this scenario I get HTTPCODE_CONNECTION_LOST and then "Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.".
Stack trace for scenario 2:
The code in asyncHTTPrequest seems to be thread-safe. I'm not sure how it is possible that asyncHTTPrequest::_onDisconnect tries to delete the same object twice when the mutex should have locked access to it and changed it to nullptr, before the lock is released and the second call is accessing it?!
Currently, I see three possible problems: a bug in the compiler, a bug in FreeRTOS or a bug (missing locks?) in AsyncTCP, but all I can tell so far is that asyncHTTPrequest has crashes sometimes when asyncHTTPrequest::_onDisconnect is (supposed to be) called.
The text was updated successfully, but these errors were encountered: