commit | a06939d49ff44aa14fd5cb907dfe9d09963262e3 | [log] [tgz] |
---|---|---|
author | Wyatt Hepler <hepler@google.com> | Thu Jan 06 09:55:18 2022 -0800 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Thu Jan 06 20:47:43 2022 +0000 |
tree | cb7321e5fd11ab808b0aa3eae760338eb13abf4a | |
parent | 4b7b09e44f828a2a6b105960835b6439fcfaf829 [diff] |
pw_rpc: Handle replacing a call with an acquired ChannelOutput buffer - When a pending RPC is called again, move its ChannelOutput buffer to the new call object. Previously, the ChannelOutput buffer was left active in the original call, which caused crashes. Moving the ChannelOutput buffer rather than closing it prevents code working with the original call object in another thread from sending a stale buffer if the call object is replaced. This is an incomplete solution, though, and more thought is needed. If the RPC body uses the OutputBuffer before passing it off to the other thread, that thread will use a stale buffer reference. - Rearrange the code that replaces the old call to avoid unlocking and relocking, which could cause problems if another call arrived while the lock wasn't held. - Expand tests to cover replacing a call with a ChannelOutput buffer acquired. Bug: 591 Change-Id: Iecb6be66d76a248683319c73fd806896d0a93be1 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/76920 Pigweed-Auto-Submit: Wyatt Hepler <hepler@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/