Draft
tests: bsim: bap: fix race on ISO lost after audio received#36
Conversation
1 task
When the BAP Unicast Client acts as an audio sink and the client sends a release command, the server stops streaming but the CIS may still be active. If the ASE state-change notification does not reach the client before the next (now empty) HCI ISO packet arrives, that packet is delivered with BT_ISO_FLAGS_LOST. Because the test is near completion, valid_rx_cnt > 1U and the FAIL was triggered even though the test had already effectively succeeded. Guard the LOST failure with !TEST_FLAG(flag_audio_received), matching the existing pattern already used for BT_ISO_FLAGS_ERROR just above. Once the minimum expected number of valid SDUs has been received, a late lost indication caused by the release/notification race is expected and should not fail the test. Fixes zephyrproject-rtos#112496
Copilot
AI
changed the title
[WIP] Fix race condition in BSIM RX test for BAP
tests: bsim: bap: fix race on ISO lost after audio received
Jul 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Late
BT_ISO_FLAGS_LOSTpackets can arrive after the BAP Unicast Client sends a release but before the ASE state-change notification is received — the server has stopped streaming while the CIS is still active. Sincevalid_rx_cnt > 1Uat end-of-test, this spuriously fails the RX callback inbap_stream_rx.c.Change
BT_ISO_FLAGS_LOSTfailure with!TEST_FLAG(flag_audio_received), mirroring the pre-existing pattern used one branch above forBT_ISO_FLAGS_ERROR. Once the minimum expected SDUs have been received, a late lost indication is expected and no longer fails the test.