fix(mdns): Fix mdns browse SYNC vs. END race - #1137
Conversation
followup on a similar fix in 9057f2d
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
b558cac to
41bffa0
Compare
* 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)
41bffa0 to
da126db
Compare
euripedesrocha
left a comment
There was a problem hiding this comment.
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"] |
There was a problem hiding this comment.
Why keep a matrix in the host tests?
There was a problem hiding this comment.
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.

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
Bug Fixes
if/esp-protocols/issues/835))
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_ENDdetaches and frees a browse while a queuedACTION_BROWSE_SYNCstill holds a borrowed pointer.browse_sync()now verifies the browse is still ons_browseand inBROWSE_RUNNINGbefore delivering notifier callbacks (mirroring the existingresult_is_cachedguard for result nodes).CI updates expand ESP-IDF coverage: target build matrix moves to
release-v5.5/v6.0/v6.1with adjusted expected Kconfig warnings for v6+, and host tests run against a matrix of IDF versions instead of a singlerelease-v5.3image.Host test app changes improve Linux console pytest reliability:
exitcallsexit(0)on Linux to avoid hung REPL threads, and IDF ≥ 6.1 usesesp_console_new_repl_stdioinstead 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.