Skip to content

fix(mdns): Fix mdns browse SYNC vs. END race - #1137

Merged
david-cermak merged 3 commits into
espressif:masterfrom
david-cermak:fix/mdns_browse_sync_end_race
Aug 28, 2026
Merged

fix(mdns): Fix mdns browse SYNC vs. END race#1137
david-cermak merged 3 commits into
espressif:masterfrom
david-cermak:fix/mdns_browse_sync_end_race

Conversation

@david-cermak

@david-cermak david-cermak commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

1)

followup fix on the recently merged #1123
(adds a similar quick fix as in 9057f2d)

2)

Update CI tests/IDF version matrix

3) 1.12.0

Features

  • add hostname change callback (c2cd90b0)
  • Make mDNS browse feature optional (2e0c2540)

Bug Fixes


Note

Medium Risk
The browse sync guard touches core mDNS action-queue concurrency; incorrect checks could drop valid notifications, but the change is narrowly scoped and aligns with an existing result-pointer pattern.

Overview
Fixes a use-after-free race in mDNS browse handling when ACTION_BROWSE_END detaches and frees a browse while a queued ACTION_BROWSE_SYNC still holds a borrowed pointer. browse_sync() now verifies the browse is still on s_browse and in BROWSE_RUNNING before delivering notifier callbacks (mirroring the existing result_is_cached guard for result nodes).

CI updates expand ESP-IDF coverage: target build matrix moves to release-v5.5 / v6.0 / v6.1 with adjusted expected Kconfig warnings for v6+, and host tests run against a matrix of IDF versions instead of a single release-v5.3 image.

Host test app changes improve Linux console pytest reliability: exit calls exit(0) on Linux to avoid hung REPL threads, and IDF ≥ 6.1 uses esp_console_new_repl_stdio instead of UART REPL on the Linux target.

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

@david-cermak david-cermak self-assigned this Aug 27, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c0282cf. Configure here.

Comment thread components/mdns/tests/host_test/dnsfixture.py Outdated
@david-cermak
david-cermak force-pushed the fix/mdns_browse_sync_end_race branch 2 times, most recently from b558cac to 41bffa0 Compare August 28, 2026 07:49
* Skip v6.0, v6.1 for host tests as linux-coop still needs fixing
* Fix tests to use gate console API on linux per IDF ver
* Use hard exit() for linux builds (to avoid unnecessary macro/version
  conditions)
1.12.0
Features
- add hostname change callback (c2cd90b)
- Make mDNS browse feature optional (2e0c254)
Bug Fixes
- Update supported/tested IDF version matrix (e842721)
- Fix mdns browse SYNC vs. END race (1b83e97)
- Only depend on esp_wifi when Wi-Fi is enabled (47724b7, espressif#835)
- Update host test to check goodbye and browse dupl (ab03980)
- Fix mdns_browse_new() return dangling pointer on duplicated browsers (e063449)
- Create static task only when SPIRAM-task-alloc is ON (6f31f27)
- validate subtype label position (a09b24f)
- ignore subtype SRV and TXT questions (7910501)
- distinguish subtype queries from instances (b910316)
- Don't free a browse result already freed by an earlier sync batch (9057f2d)
Updated
- test(mdns): add hostname callback target test (4c8b76d)
- test(mdns): add hostname callback host test (1f35d5f)
- test(mdns): cover subtype query handling (c14ed4f)
- refactor(mdns): share debug name formatting (8c7bc86)
@david-cermak
david-cermak force-pushed the fix/mdns_browse_sync_end_race branch from 41bffa0 to da126db Compare August 28, 2026 08:10

@euripedesrocha euripedesrocha left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a minor comment on host test matrix.

name: Host test build
strategy:
matrix:
idf_ver: ["latest", "release-v5.3", "release-v5.4", "release-v5.5"]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why keep a matrix in the host tests?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, not really necessary, but I was thinking in CI resources -- the host tests are cheap/quick and mdns code has some IDF_VERSION ifdefs, so it's yes another (fast) feedback if something broke.

@david-cermak
david-cermak merged commit db06b19 into espressif:master Aug 28, 2026
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants