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

chore(gui-client): proof of concept for process splitting #4788

Merged
merged 15 commits into from
Apr 26, 2024

Conversation

ReactorScram
Copy link
Collaborator

@ReactorScram ReactorScram commented Apr 25, 2024

Closes #4270

Refs #3713
Refs #3782

It sort-of works, but many features are missing and it needs a refactor.

Tasks

Edit tasklist title
Beta Give feedback Tasklist Tasks, more options

Delete tasklist

Delete tasklist block?
Are you sure? All relationships in this tasklist will be removed.
  1. Break imp_linux.rs into modules
    Options
  2. Get rid of try_send and panics where possible
    Options

@ReactorScram ReactorScram added area/linux_client Linux client area/tauri_client The Windows and Linux Tauri GUI clients labels Apr 25, 2024
@ReactorScram ReactorScram self-assigned this Apr 25, 2024
Copy link

vercel bot commented Apr 25, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
firezone ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 26, 2024 7:30pm

@github-actions github-actions bot added the kind/chore Issues related to repository cleanup or maintenance label Apr 25, 2024
Copy link

github-actions bot commented Apr 25, 2024

Terraform Cloud Plan Output

Plan: 15 to add, 14 to change, 15 to destroy.

Terraform Cloud Plan

Copy link

github-actions bot commented Apr 25, 2024

Performance Test Results

TCP

Test Name Received/s Sent/s Retransmits
direct-tcp-client2server 243.2 MiB (+2%) 245.1 MiB (+1%) 327 (+5%)
direct-tcp-server2client 244.0 MiB (+0%) 245.5 MiB (+0%) 206 (-39%)
relayed-tcp-client2server 225.4 MiB (-1%) 226.5 MiB (-0%) 213 (-25%)
relayed-tcp-server2client 236.0 MiB (-0%) 236.9 MiB (+0%) 481 (+60%)

UDP

Test Name Total/s Jitter Lost
direct-udp-client2server 50.0 MiB (-0%) 0.31ms (+15%) 0.00% (NaN%)
direct-udp-server2client 50.0 MiB (-0%) 0.01ms (-18%) 0.00% (NaN%)
relayed-udp-client2server 50.0 MiB (-0%) 0.07ms (+39%) 0.00% (NaN%)
relayed-udp-server2client 50.0 MiB (+0%) 0.01ms (-36%) 0.00% (NaN%)

self.tun = Some(Tun::new(config, dns_config, callbacks)?);
self.tun = Some(Tun::new(config, dns_config.clone(), callbacks)?);

callbacks.on_set_interface_config(config.ipv4, config.ipv6, dns_config);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appeared to be missing from the Linux impl, I need it to act as on_tunnel_ready

Comment on lines +197 to +198
// TODO: Should this default to 30 days?
let max_partition_time = cli.max_partition_time.map(|d| d.into());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I pass None for max partition time?

@@ -513,7 +521,7 @@ struct Session {
impl Controller {
// TODO: Figure out how re-starting sessions automatically will work
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Clients don't need to automatically restart connlib sessions, do they? This comment might be out of date.

Comment on lines +88 to +103
// TODO: Make sure this joins / drops somewhere
let recv_task = tokio_handle.spawn(async move {
while let Some(msg) = rx.next().await {
let msg = msg?;
let msg: IpcServerMsg = serde_json::from_slice(&msg)?;
match msg {
IpcServerMsg::Ok => {}
IpcServerMsg::OnDisconnect => callback_handler.on_disconnect(
&connlib_client_shared::Error::Other("errors can't be serialized"),
),
IpcServerMsg::OnUpdateResources(v) => callback_handler.on_update_resources(v),
IpcServerMsg::TunnelReady => callback_handler.on_tunnel_ready(),
}
}
Ok(())
});
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The IPC itself could probably use improvement, maybe one of those poll functions like I use for signals and disconnect somewhere else in the PR.

This is working enough for a demo

}

// Callbacks must all be non-blocking
// TODO: DRY
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are 4 of these CallbackHandler structs now, but they're all subtly different, so I didn't try to de-dupe them yet.

I considered trying to fit them all into a "wake-and-poll" pattern but this would probably make the code longer, not shorter, and it would make the IPC protocol a little more chatty. (e.g. instead of the service just sending new resources to the Client, it would send a wake, then the Client would make a request, then the service would respond. I think this is more robust if the system is CPU-starved but in practice it probably doesn't matter at all.)

@ReactorScram ReactorScram marked this pull request as ready for review April 26, 2024 16:16
Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Copy link
Member

@jamilbk jamilbk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense. Just verifying -- by merging this we aren't blocking any bugfix updates that the Windows client might need, correct?

@ReactorScram
Copy link
Collaborator Author

Blocking as in, causing merge conflicts, or taking time away from them? I don't think there's anything important on Windows, there's a couple issues which are either not replicating or aren't critical https://github.com/firezone/firezone/issues?q=is%3Aopen+is%3Aissue+label%3Aarea%2Fwindows_client+

@ReactorScram
Copy link
Collaborator Author

I smoke-tested the MSI built from bbba458 and it passed. Signs in, controls DNS, ifconfig.net goes through the tunnel

@jamilbk
Copy link
Member

jamilbk commented Apr 26, 2024

SGTM

@ReactorScram ReactorScram added this pull request to the merge queue Apr 26, 2024
Merged via the queue into main with commit c8d989a Apr 26, 2024
134 checks passed
@ReactorScram ReactorScram deleted the chore/process-split-poc branch April 26, 2024 20:11
ReactorScram added a commit that referenced this pull request May 22, 2024
I accidentally modified a function that's used in both Android and Linux,
this PR splits it up into two functions
github-merge-queue bot pushed a commit that referenced this pull request May 22, 2024
Closes #5086
I accidentally modified a function that's used in both Android and
Linux, this PR splits it up into two functions

```[tasklist]
### Before merging
- [x] Check aarch64 deb still signs in (716320)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/linux_client Linux client area/tauri_client The Windows and Linux Tauri GUI clients kind/chore Issues related to repository cleanup or maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

chore(gui-client): prototype process splitting for Linux GUI
2 participants