-
Notifications
You must be signed in to change notification settings - Fork 145
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
esp_websocket: fix a crash when network anomaly (IDFGH-13461) #629
Conversation
xutao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
could you please click trough the CLA agreement so we can accept your contribution?
Thank you for the update! I noticed that there are now two commits from different authors, and the pre-commit test didn’t pass. Could you please review our contribution guidelines and update this PR accordingly? Specifically, it would be great if you could:
If you’d prefer, just let me know -- I can take care of the chores and push your work in a separate PR, while still crediting your original commit. |
When WiFi disconnects, `esp_websocket_client_task` continues polling `esp_transport_poll_read()` with a default 1-second timeout. If a timeout triggers `esp_websocket_client_abort_connection`, certain resources are released. However, if `esp_websocket_client_send_with_exact_opcode` is still blocked at this point, it will cause a crash when it times out and accesses the released handle. This fix prevents potential crashes by ensuring proper synchronization between abort and send functions. Merges: espressif#629
When WiFi disconnects, `esp_websocket_client_task` continues polling `esp_transport_poll_read()` with a default 1-second timeout. If a timeout triggers `esp_websocket_client_abort_connection`, certain resources are released. However, if `esp_websocket_client_send_with_exact_opcode` is still blocked at this point, it will cause a crash when it times out and accesses the released handle. This fix prevents potential crashes by ensuring proper synchronization between abort and send functions. Merges: espressif#629
when disconnect the wifi, the esp_websocket_client_task continue to called
esp_transport_poll_read to read, but the default the time is 1s, then the read had timeout will called esp_websocket_client_abort_connection to destory some handle, at this time, esp_websocket_client_send_with_exact_opcode still blocked.
when esp_websocket_client_send_with_exact_opcode had timeout, will trigger crash , because handle(erro handle) already release