Skip to content

l2cap: Resolve teardown hang on disconnect collision or abort#937

Draft
uier wants to merge 2 commits into
mainfrom
l2cap-disconnect-abort-hang
Draft

l2cap: Resolve teardown hang on disconnect collision or abort#937
uier wants to merge 2 commits into
mainfrom
l2cap-disconnect-abort-hang

Conversation

@uier

@uier uier commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Resolve a teardown hang in LeCreditBasedChannel. When a disconnection collision occurs (both DUT and peer call disconnect simultaneously) or the channel is aborted during disconnection, the connection state transitions to DISCONNECTED before the peer's response arrives (or is ignored). In these cases, the disconnection_result future remained unresolved, causing any awaiting teardown task to hang.

This patch ensures that calling abort() or receiving a disconnection request while in the DISCONNECTING state correctly resolves disconnection_result and cleans up the channel.

Verification:
Verified with a new unit test test_abort_while_disconnecting added to tests/l2cap_test.py that stubs a non-responsive peer and calls abort() during the DISCONNECTING state transition, confirming it completes immediately.

@uier uier force-pushed the l2cap-disconnect-abort-hang branch from da093ad to ab024b9 Compare June 16, 2026 12:14
uier added 2 commits June 16, 2026 12:18
Resolve a teardown hang in LeCreditBasedChannel. When a disconnection
collision occurs (both DUT and peer call disconnect simultaneously) or the
channel is aborted during disconnection, the connection state transitions
to DISCONNECTED before the peer's response arrives (or is ignored).
In these cases, the `disconnection_result` future remained unresolved,
causing any awaiting teardown task to hang.

This patch ensures that calling abort() or receiving a disconnection request
while in the DISCONNECTING state correctly resolves `disconnection_result` and
cleans up the channel.

Verification:
1. Verified with a new unit test `test_abort_while_disconnecting` added
   to `tests/l2cap_test.py` that stubs a non-responsive peer and calls
   abort() during the DISCONNECTING state transition, confirming it completes immediately.
2. Verified that the Google3 test target `//third_party/py/bumble:tests/l2cap_test` builds and passes.
3. Verified that the physical Mobly test target `//wireless/android/pixel/bluetooth/testing/tests/cts_v:l2cap_coc_server_test_mpt` now runs to completion on connected devices without hanging.

TAG=agy
CONV=30ac9cde-ad7a-4570-9bc6-5da55df17fc7
@uier uier force-pushed the l2cap-disconnect-abort-hang branch from ab024b9 to 5464d43 Compare June 16, 2026 12:20
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