-
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
Make RPC call synchronous in Fabric Sync #34187
Conversation
PR #34187: Size comparison from 5e37260 to 8b7f10d Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Busy waiting on shared data is guaranteed to be racy
- Instead, replace the RPC operations to be "starts" of operations which can be polled by a status RPC by the caller, for example. Alternatively, consider using event loop posting design with a separate worker to have a way to broker synchronization.
Please describe what operations need to be done in what order. |
I want to make all RPC call synchronous, so that I don't have to maintain a state machine that has transitions at specific events. Updated the PR, the WaitForResponse function uses a condition variable to wait for the response or timeout. The response completion callbacks (OnAddDeviceResponseCompleted and OnRemoveDeviceResponseCompleted) set the response flags and notify the waiting thread. This avoids busy waiting and makes the code more efficient and responsive. |
PR #34187: Size comparison from 8ebe19d to 8c4f13a Increases above 0.2%:
Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
* Make RPC call synchronous in Fabric Sync * Address review comments
* Make RPC call synchronous in Fabric Sync * Address review comments
* Make RPC call synchronous in Fabric Sync * Address review comments
* Make RPC call synchronous in Fabric Sync * Address review comments
We need to make all RPC call synchronous in Fabric Sync to grantee the correct sequence of Fabric Sync.
I have explored all possible options to make an RPC call synchronous but found that busy-waiting is the most reliable option so far.
A better option would be to use the pw client synchronous call wrappers, but they are quite expensive and not available in the current nanopb integration in the CHIP project.
Fixes #33784