tree: a02ce07a67b3468c39cb6079da945e6ebd3a7ddd [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 run /core/ffx-laboratory:echo_realm fuchsia-pkg://fuchsia.com/components-routing-failed-example-cpp#meta/default.cm
    
  • Rust

    $ ffx component run /core/ffx-laboratory:echo_realm fuchsia-pkg://fuchsia.com/components-routing-failed-example-rust#meta/default.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: Required protocol `fidl.examples.routing.echo.Echo` was not available for target component `/core/ffx-laboratory:echo_realm/echo_client`:
`/core/ffx-laboratory:echo_realm/echo_client` tried to use `fidl.examples.routing.echo.Echo` from its parent, but the parent does not offer that capability. Note, use clauses in CML default to using from parent.

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

[component_manager] WARN: Failed to start component `echo_server_bad#meta/default.cm`:
unable to load component with url "echo_server_bad#meta/default.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