Skip to content

UpdateManager: release download mutex when HTTP client setup fails - #21

Open
jamesmulcahy wants to merge 1 commit into
NSPManager:develfrom
jamesmulcahy:fix/download-data-mutex-leak
Open

jamesmulcahy wants to merge 1 commit into
NSPManager:develfrom
jamesmulcahy:fix/download-data-mutex-leak

Conversation

@jamesmulcahy

Copy link
Copy Markdown
Contributor

Summary

_download_data takes _download_data_store_mutex with portMAX_DELAY, but only gives it back inside the branch where _setup_http_client succeeded. If setup fails (e.g. setting the Range header fails), the function returns with the mutex still held, and every later checksum fetch or download blocks forever.

This PR:

  • Releases the mutex (and clears _download_data_store) when _setup_http_client fails.
  • Makes _setup_http_client return an error if esp_http_client_init returns NULL, instead of passing a NULL handle on to set_header/perform.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X7aYyRjzk53Sd7gxF46E3u

_download_data took _download_data_store_mutex but only released it when
_setup_http_client succeeded. A setup failure left the mutex held, so all
later checksum fetches and downloads blocked forever. Also fail early if
esp_http_client_init returns NULL instead of using a NULL handle.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X7aYyRjzk53Sd7gxF46E3u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant