Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chip-tool can end up cleaning up interaction model objects on the wrong thread. #21599

Closed
bzbarsky-apple opened this issue Aug 3, 2022 · 0 comments · Fixed by #21600
Closed

Comments

@bzbarsky-apple
Copy link
Contributor

Problem

Steps to reproduce:

  1. Build chip-tool and all-clusters-app.
  2. In terminal 1, run all-clusters-app.
  3. In terminal 2, run chip-tool interactive start
  4. At chip-tool prompt run pairing code 17 749701123365521327694
  5. At chip-tool prompt run basic subscribe data-model-revision 1 100 17 0
  6. Kill all-clusters-app.
  7. At chip-tool prompt run basic subscribe data-model-revision 1 100 17 0 --timeout 3

We fail threading assertions:

[1659545395124] [27950:4732727] CHIP: [DL] Chip stack locking error at '../../../examples/chip-tool/third_party/connectedhomeip/src/transport/Session.h:66'. Code is unsafe/racy

The issue is that that command instance has live a ReadClient from the first command execution that is still figuring out that its subscription is gone and hence has not called OnDone or anything.

When the second command times out, we land in CHIPCommand::Run, have deferCleanup false (because DeferInteractiveCleanup() returned false, because mSubscriptionEstablished was false in the second subscribe command), call Cleanup(), this destroys the ReadClients and now we are running IM code on the wrong thread and everything will be bad.

Proposed Solution

Need to figure out how to do this cleanup properly.

bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Aug 3, 2022
We were doing it from the wrong thread in some cases.

Fixes project-chip#21599
bzbarsky-apple added a commit to bzbarsky-apple/connectedhomeip that referenced this issue Aug 3, 2022
We were doing it from the wrong thread in some cases.

Fixes project-chip#21599
woody-apple pushed a commit that referenced this issue Aug 4, 2022
We were doing it from the wrong thread in some cases.

Fixes #21599
isiu-apple pushed a commit to isiu-apple/connectedhomeip that referenced this issue Sep 16, 2022
We were doing it from the wrong thread in some cases.

Fixes project-chip#21599
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 a pull request may close this issue.

1 participant