Skip to content

fix(websocket): set STOPPED_BIT before task create to avoid stop()/de…#1098

Open
gabsuren wants to merge 1 commit into
espressif:masterfrom
gabsuren:fix/ws_clear_stop_bit
Open

fix(websocket): set STOPPED_BIT before task create to avoid stop()/de…#1098
gabsuren wants to merge 1 commit into
espressif:masterfrom
gabsuren:fix/ws_clear_stop_bit

Conversation

@gabsuren

@gabsuren gabsuren commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Related #1096


Note

Medium Risk
Touches client start/stop synchronization in embedded networking code; incorrect bit ordering could cause hangs or premature teardown, but the change is small and targeted.

Overview
Fixes a lifecycle race in esp_websocket_client_start() where stop() or destroy() could mis-handle a client that was mid-start or had a failed task spawn (see #1096).

STOPPED_BIT is cleared before xTaskCreatePinnedToCore, so callers no longer treat the client as fully stopped while a websocket task may already exist or start is in progress. STOPPED_BIT is set again if task creation fails, restoring the initialized “stopped” state so stop()/destroy() do not block forever waiting for a task that never started.

Reviewed by Cursor Bugbot for commit b2b86d7. Bugbot is set up for automated code reviews on this repo. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants