[ANN] capnp-rpc 0.3: Unikernel support!



I’m pleased to announce the release of capnp-rpc 0.3, an OCaml implementation of the Cap’n Proto RPC specification.

If you haven’t used the library before, please see the documentation and tutorial. Cap’n Proto RPC aims to provide secure, efficient, typed communications between multiple parties.

Changes since v0.2

New features

This release adds a new capnp-rpc-mirage package, which provides support for using the library within a MirageOS unikernel. See https://github.com/mirage/capnp-rpc#how-can-i-use-this-with-mirage for details.

This makes use of the new capnp 3.1.0 release, which removes all uses of Core_kernel and Unix from the runtime library.

Documentation and examples

  • The documentation now includes some diagrams to clarify the various example scenarios.

  • Fixed a ref-counting bug in the calculator example. Also, changed the service ID to match what the C++ client expects. With these changes, the C++ client’s tests pass when used with the OCaml service.

API changes

There are a few minor API changes:

  • Capnp_rpc_unix.Vat_config.derived_id ?name config is now Capnp_rpc_unix.Vat_config.derived_id config name. If you weren’t passing a ~name argument before, use "main" to get the same ID.

  • Capnp_rpc_unix.Network's Socket_address module is now called Location.

  • There is an explicit network parameter in Network.connect, etc. This is needed to support Mirage, where the network isn’t a global.

Bug fixes

  • Fix race when reconnecting. We notified the user that the capability had broken while the old connection was still shutting down. If they immediately tried to reconnect, we tried to reuse the old connection. Now, we wait for it to be removed.

  • Fix handling of leaks in switchable. If we detected the ref-count was invalid, we tried to resolve to an error, but resolving now checks that the ref-count is valid first so this failed.


  • Also test answering questions with errors or with a promise from another question.

Code cleanups

  • Use a better way to get the client certificate from a TLS connection (suggested by @hannes).

  • Use Alcotest_lwt for unit-tests.

  • Move capnp:// URI handling to Capnp_rpc_lwt.Capnp_address. This allows it to be shared with the Mirage code.

  • Add Capnp_rpc_lwt.VAT_NETWORK with simpler signature than S.VAT_NETWORK.

  • The address sub-module of S.NETWORK is now available separately as S.ADDRESS.