Are multiple calls to AsyncClient::_discard_cb intentional? #80
Closed
mastersign
started this conversation in
Support
Replies: 2 comments
-
I already saw this issue from time to times yes and I merged a PR from @willmmiles 4 hours ago that is likely to fix this long standing issue (#79). Can you try with the new release ? The callback should obviously be called once and there should not be any double free. |
Beta Was this translation helpful? Give feedback.
0 replies
-
The heap corruption does not occur with AsyncTCP 3.4.6. I conclude, that the fixed race condition between close and fin resolved the double call of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using AsyncTCP as part of ESPAsyncWebServer and I occasional get a heap corruption.
The reason is, that in some scenarios
AsyncClient::_close()
andAsyncClient::_fin()
are called in succession. They call_discard_cb
with the following call sequence:AsyncClient::_discard_cb
= Lambda fromAsyncWebServerRequest
constructorAsyncWebServerRequest::_onDisconnect()
AsyncWebServer::_handleDisconnect()
delete request
→ double free!So my question is: Is it intentional, that the onDisconnect callback of an
AsyncClient
is called multiple times?ESPAsyncWebServer
library. Somehow the freeing of the request instance must be reworked._discard_cb
inAsyncClient
should be followed by a_discard_cb = NULL
.The phenomenon occures more often when connecting from a mobile Chrome browser on Android, then from a Chrome on PC. My guess is, that the connection handling differs somewhat.
Beta Was this translation helpful? Give feedback.
All reactions