TL;DR: To avoid race conditions, we are changing FIDL bindings behavior to hide PEER_CLOSED errors when making one-way calls and sending replies/events. This is done for C++, and will be soon for Rust.
In the past, most FIDL bindings have exposed PEER_CLOSED errors from one-way interactions (clients making one-way calls, servers sending replies, and servers sending events). This was a mistake because it leads to racy code, so we are now fixing it, tracked in fxbug.dev/113160:
C++: fixed in December, fxrev.dev/780723
Rust: fixed once fxrev.dev/794344 lands
HLCPP, Dart: never had the problem
Go: not fixed yet
Conceptually, one-way interactions are “fire and forget”. There is never any guarantee that the receiver has received the message. Even if the channel write succeeds, the remote party could close their channel immediately after that without reading the message. If you want feedback from the remote party, you need to use a two-way method.
While fixing Rust code, one pattern I noticed was error handling for pipelined one-way calls such as fuchsia.io/Directory.Open. With racy PEER_CLOSED errors, there was often duplicate error handling: on the one-way call (in case the directory is closed) and again on the pipelined channel (in case it gets closed without being bound to a server). With PEER_CLOSED hidden on one-way calls, it’s clear that this logic should be consolidated to the second case.
Let me know if you have any questions.
Mitchell
--
All posts must follow the Fuchsia Code of Conduct https://fuchsia.dev/fuchsia-src/CODE_OF_CONDUCT or may be removed.
---
You received this message because you are subscribed to the Google Groups "fidl-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fidl-dev+u...@fuchsia.dev.
To view this discussion on the web visit https://groups.google.com/a/fuchsia.dev/d/msgid/fidl-dev/CAF4EkWWTQhDu-xCuppsKwjj40jTSs0GZ3DktY8gnA_spjji3mw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/a/fuchsia.dev/d/msgid/fidl-dev/CALekkJdS64J%2BxMvw6cT5KTQuo4iN2SWKa7BdUd9OR%2B2UMuoVew%40mail.gmail.com.