Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reuse debug.Server instance across clients. #75

Closed
wants to merge 1 commit into from

Conversation

lthibault
Copy link
Contributor

@lthibault lthibault commented Apr 29, 2023

This PR uses capnp.WeakClient to reuse a single debug.Server instance across multiple clients. This reduces memory consumption by reducing the number of *server.Server instances, and corresponding goroutines. While this is not strictly necessary (we're not under any particular memory pressure), it also happens to simplify some of the server instantiation logic in feat/auth branch of Wetware (WIP).

Things to look out for during code-review:

  1. Concurrent calls to Debugger() can happen concurrently if the Server is exported to a vat, and multiple incoming streams are handled in parallel. This doesn't happen in Wetware, but is part of CASM's public contract.
  2. The the debugger client may be created and released repeatedly, so Debugger() must be able to instantiate a client more than once.
  3. WeakClient.AddRef()'s boolean return value specifically indicates whether the capability has been released. Notably, a nil *WeakClient will return true, so we must include a nil-pointer check.

Similar PRs in https://github.com/wetware/ww will follow.

@lthibault
Copy link
Contributor Author

Closing. #79 removes the debug.Server

@lthibault lthibault deleted the enhancement/reuse-debug-server branch July 5, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant