Skip to content

#265: Access supervision sessions only under the session lock - #293

Merged
Peter Balogh (silabs-peterb) merged 1 commit into
SiliconLabsSoftware:mainfrom
silabs-MarkM:265-access-supervision-sessions-only-under-the-session-lock
Nov 13, 2026
Merged

Peter Balogh (silabs-peterb) merged 1 commit into
SiliconLabsSoftware:mainfrom
silabs-MarkM:265-access-supervision-sessions-only-under-the-session-lock

Conversation

@silabs-MarkM

Copy link
Copy Markdown
Contributor

Issue

Closes: None

Change

TX complete and RX report handlers raced on session status and expiry. Copy or update session fields under the lock and re-arm the timer after release.

Checklist

@siliconlabsdevops-svc-devops

Copy link
Copy Markdown

GitHub PR artifact is not available. Re-run CI, then apply the CTT label again.

@siliconlabsdevops-svc-devops siliconlabsdevops-svc-devops Bot removed the CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation label Nov 10, 2026
@silabs-MarkM

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor

cursor Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes concurrency and timeout behavior on the Z-Wave Supervision TX/RX path; incorrect locking or callback ordering could mis-report command outcomes, but scope is limited to the supervision command class.

Overview
Fixes races between TX completion and incoming Supervision Reports by guarding the session map with a recursive mutex and routing all mutations through new locked helpers.

Session lifecycle: zwave_command_class_supervision_copy_session_id, zwave_command_class_supervision_handle_send_data_complete, and zwave_command_class_supervision_handle_incoming_report update status, expiry, and tx_info under supervision_sessions_lock, then invoke user callbacks and re-arm the supervision timer after releasing the lock. Report parsing in command_class_supervision.cpp and the TX complete path in zwave_command_class_supervision.c now delegate to these APIs instead of touching session pointers directly.

Timer behavior: Expiry scanning batches failed sessions, fires callbacks outside the lock, and zwave_command_class_supervision_restart_timer arms the next deadline while holding the same mutex so concurrent TX/RX updates cannot overwrite a newer expiry. Wire session IDs use an atomic next_session_id; send path reads the ID via copy_session_id rather than dereferencing a session after create.

Reviewed by Cursor Bugbot for commit a412098. Configure here.

@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.

Stale Bugbot comment from a previous run.

@silabs-MarkM
Márk Mihalik | SiliconLabs (silabs-MarkM) force-pushed the 265-access-supervision-sessions-only-under-the-session-lock branch from f2dc1a4 to a412098 Compare November 12, 2026 12:13
@silabs-MarkM

Copy link
Copy Markdown
Contributor Author

bugbot run

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit a412098. Configure here.

@silabs-MarkM Márk Mihalik | SiliconLabs (silabs-MarkM) added the CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation label Nov 12, 2026
@siliconlabsdevops-svc-devops siliconlabsdevops-svc-devops Bot removed the CTT Requested (Full Set) CTT Testing with full scope is requested from CTT Automation label Nov 12, 2026
@siliconlabsdevops-svc-devops

Copy link
Copy Markdown

CTT Jenkins job: $zpc_ctt_jenkins_url/job/zw-ctt-automation-multibranch/job/main/4157/

@silabs-MarkM Márk Mihalik | SiliconLabs (silabs-MarkM) added the Under review Request or issue under review label Nov 12, 2026
@silabs-peterb

Copy link
Copy Markdown
Collaborator

CTT Jenkins job: $zpc_ctt_jenkins_url/job/zw-ctt-automation-multibranch/job/main/4157/

No regression was introduced 👌

…ession lock

TX complete and RX report handlers raced on session status and expiry.
Copy or update session fields under the lock and re-arm the timer after release.

Signed-off-by: Márk Mihalik <Mark.Mihalik@silabs.com>
@silabs-peterb
Peter Balogh (silabs-peterb) force-pushed the 265-access-supervision-sessions-only-under-the-session-lock branch from a412098 to c7a7dc7 Compare November 13, 2026 09:36
@silabs-peterb
Peter Balogh (silabs-peterb) merged commit 4c885d9 into SiliconLabsSoftware:main Nov 13, 2026
13 of 18 checks passed
@silabs-peterb
Peter Balogh (silabs-peterb) deleted the 265-access-supervision-sessions-only-under-the-session-lock branch November 13, 2026 10:05
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Bug Issue is a bug report Silicon Labs development PR contents developed by Silicon Labs Under review Request or issue under review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants