commit | bfc170d6e1ac572b3e74403fe45269ac7e5d67ad | [log] [tgz] |
---|---|---|
author | Wyatt Hepler <hepler@google.com> | Thu Feb 02 00:16:07 2023 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Feb 02 00:16:07 2023 +0000 |
tree | 9a35a5d08f47b7b782390c664727971d8550e1fd | |
parent | 376cbc1f50b431a59f2996405126172ab29bfe20 [diff] |
pw_rpc: Fix callback synchronization issues - Move the on_next callback to a local variable while the lock is held, then invoke it. Restore on_next when done, if the call has not been closed or on_next changed since. - Track whether callbacks are executing in the call object. - If a new stream packet arrives while another callback is running, drop it since the on_next callback is not available. - Hold the lock while invoking on_next or on_completed callback wrappers that decode to a Nanopb or pwpb struct. - Guard the serde objects with the RPC lock. - Wait until callbacks complete before moving or destroying a call object. This helps prevent dangling references in RPC callbacks. Bug: b/234876851, b/262774186 Change-Id: I9d853001dc27abef0c1fade0057d1da635f622cb Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126919 Pigweed-Auto-Submit: Wyatt Hepler <hepler@google.com> Reviewed-by: Khalil Estell <kammce@google.com> Reviewed-by: Alexei Frolov <frolv@google.com> Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.