-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
DeviceCommissioner does not handle async operations across commissioning stop/start correctly #21120
Comments
Issue Review: Assigning to @bzbarsky-apple to take a look to see if this can be done for 1.0 |
Has there been any thoughts/work on improving this? I'm also trying to use the In my case, the administrator/commissioner runs on the same device, only on-network resolve and using the built-in How broken it is and what happens depends on the commissioning state. Here are a few situations what happens for some different current states when
Apart from being broken, I also miss proper API documentation for the
Without this being in place, it's hard to review PRs such as #28939 and #28881 if they behave correctly or not, with respect to expected callbacks. Do those PRs for example correctly fix #25724? I agree with the proposed solution that there should not be a "global" delegate for the commissioner. Another way that I think would work is to use the feature of the interaction model objects ( In my opinion, each |
@Emill I've got a plan for what to do here, but have not had a chance to do it. If someone else steps up to work on this, I would be very happy. |
Problem
DeviceCommissioner kicks off various un-cancelable async operations (device attestation verification, NOC issuance, commands sent via the InteractionModel.h/CHIPCluster.h APIs). If the consumer calls
StopPairing
and then starts a new commissioning process during one of these async operations, when the operation result comes back it will be applied to the wrong commissioning process. This means in practiceStopPairing
is not really usable.And shutting down the DeviceCommissioner during any of those async bits is liable to crash with use-after-free.
Proposed Solution
What we should probably do is that instead of using the DeviceCommissioner itself as the callback context for async operations
we should use some per-commissioning-process or per-async-operation object that lives until the async operation completes and has a back-pointer to the DeviceCommissioner. The DeviceCommissioner can null out that backpointer as needed (when it's shut down, or on
StopPairing
, etc), which will make the async callback get ignored when it happens.This is sort of reimplementing
Callback
to some extent, but the problem is that in practice the async bits are not usingCallback
and changing them to use it would be fairly difficult.@mrjerryjohns @cecille @tcarmelveilleux @tehampson @vivien-apple @msandstedt
The text was updated successfully, but these errors were encountered: