tree: 042f3f415ad6c670b8fdbb22db4643fa547168b2 [path history] [tgz]
  1. cpp/
  2. meta/
  3. rust/
  4. BUILD.gn
  5. README.md
examples/components/routing_failed/README.md

Failed routing Example

This directory contains an example of failed capability routing in Component Framework.

Building

If these components are not present in your build, they can be added by appending --with //examples to your fx set command. For example:

$ fx set core.x64 --with //examples
$ fx build

Running

Use ffx component create to create the component instances inside a restricted realm for development purposes:

  • C++

    $ ffx component create /core/ffx-laboratory:echo_realm fuchsia-pkg://fuchsia.com/components-routing-failed-example-cpp#meta/echo_realm.cm
    
  • Rust

    $ ffx component create /core/ffx-laboratory:echo_realm fuchsia-pkg://fuchsia.com/components-routing-failed-example-rust#meta/echo_realm.cm
    

Start the client component instance by passing its moniker to ffx component start:

$ ffx component start /core/ffx-laboratory:echo_realm/echo_client

When the above command is run, you can see the component framework error messages with fx log. The Echo protocol request fails due to a routing error:

[echo_client] WARNING: Failed to route protocol `fidl.examples.routing.echo.Echo` with target component `/core/ffx-laboratory:echo_realm/echo_client`:
A `use from parent` declaration was found at `/core/ffx-laboratory:echo_realm/echo_client` for `fidl.examples.routing.echo.Echo`, but no matching `offer` declaration was found in the parent

The Echo2 protocol request fails due to an issue starting the component:

[component_manager] WARN: Failed to start component `fuchsia-pkg://fuchsia.com/components-routing-failed-example#meta/echo_server_bad.cm`:
unable to load component with url "fuchsia-pkg://fuchsia.com/components-routing-failed-example#meta/echo_server_bad.cm":
error loading executable: "reading object at \"bin/routing_failed_echo_server_oops\" failed: A FIDL client's channel to the service (anonymous) File was closed: NOT_FOUND

After running the example, you can remove the example realm using ffx component destroy:

$ ffx component destroy /core/ffx-laboratory:echo_realm