Skip to content

Conversation

@ReactorScram
Copy link
Contributor

Closes #5052

On my dev VMs:

  • systemd-resolved = 15 ms to flush
  • Windows = 600 ms to flush

I tested with the headless Clients on Linux and Windows and it fixes the issue. On Windows I didn't replicate the issue with the GUI Client, on Linux this patch also fixes it for the GUI Client.

@ReactorScram ReactorScram self-assigned this Jul 3, 2024
@vercel
Copy link

vercel bot commented Jul 3, 2024

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
firezone ⬜️ Ignored (Inspect) Visit Preview Jul 3, 2024 8:18pm

@github-actions
Copy link

github-actions bot commented Jul 3, 2024

Terraform Cloud Plan Output

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

Terraform Cloud Plan

@github-actions
Copy link

github-actions bot commented Jul 3, 2024

Performance Test Results

TCP

Test Name Received/s Sent/s Retransmits
direct-tcp-client2server 234.0 MiB (-2%) 235.3 MiB (-2%) 320 (-1%)
direct-tcp-server2client 244.4 MiB (+3%) 246.3 MiB (+3%) 223 (-43%)
relayed-tcp-client2server 236.5 MiB (+0%) 237.8 MiB (+0%) 434 (-5%)
relayed-tcp-server2client 236.8 MiB (-0%) 238.2 MiB (-0%) 554 (-26%)

UDP

Test Name Total/s Jitter Lost
direct-udp-client2server 500.0 MiB (+0%) 0.03ms (-41%) 41.57% (-17%)
direct-udp-server2client 500.0 MiB (-0%) 0.02ms (-34%) 22.49% (-4%)
relayed-udp-client2server 500.0 MiB (+0%) 0.08ms (+3%) 53.65% (-2%)
relayed-udp-server2client 500.0 MiB (+0%) 0.02ms (-49%) 31.53% (-15%)

@ReactorScram ReactorScram marked this pull request as ready for review July 3, 2024 20:16
Comment on lines +195 to +198
| InternalServerMsg::Ipc(IpcServerMsg::OnUpdateResources(_)) => {
// On every resources update, flush DNS to mitigate <https://github.com/firezone/firezone/issues/5052>
dns_controller.flush()?;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The callback handler code here is duplicated between the IPC service and the headless Client. Since they do almost the same thing, we can probably refactor it someday so that they share the same main loop, and the only difference is that one listens for IPC events and one listens for in-process commands

@ReactorScram ReactorScram requested a review from conectado July 3, 2024 20:19
@jamilbk
Copy link
Member

jamilbk commented Jul 3, 2024

I think this may also be the cause of #4834. Linking it here so we have a thread to investigate when we can tackle that issue. Unfortunately from preliminary Googling I don't know if we have a button to push there for Android.

Will need to test if this is also an issue on macOS / iOS but I don't think it is. I believe the OS either doesn't use a cache or flushes it for us.

@ReactorScram
Copy link
Contributor Author

Yeah on macOS I did not get it to replicate. But that's strange because ChatGPT says macOS has a cache, and the fix in this PR is to flush when our resources change, which the OS shouldn't be aware of. So why doesn't it happen on other OSes?

Copy link
Contributor

@conectado conectado left a comment

Choose a reason for hiding this comment

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

Nice work!

@ReactorScram ReactorScram added this pull request to the merge queue Jul 3, 2024
Merged via the queue into main with commit f6e9975 Jul 3, 2024
@ReactorScram ReactorScram deleted the fix/flush-dns-cache-more branch July 3, 2024 21:27
ReactorScram added a commit that referenced this pull request Jul 3, 2024
PR #5700 had a typo in it. I didn't notice that these match arms use `|`, so
I accidentally flush the DNS for an event that doesn't need it.
Only `OnUpdateResources` should flush DNS.
@jamilbk
Copy link
Member

jamilbk commented Jul 4, 2024

Yeah on macOS I did not get it to replicate. But that's strange because ChatGPT says macOS has a cache, and the fix in this PR is to flush when our resources change, which the OS shouldn't be aware of. So why doesn't it happen on other OSes?

It's possible macOS does not have a cache before the DNS servers for VPN interfaces, to prevent this sort of issue. I assume Windows and Linux do cache before queries reach the tunnel interface, and possibly Android too.

github-merge-queue bot pushed a commit that referenced this pull request Jul 5, 2024
PR #5700 had a typo in it. I didn't notice that these match arms use
`|`, so I accidentally flush the DNS for an event that doesn't need it.
Only `OnUpdateResources` should flush DNS.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(client): adding service actor to group / enabling policy only takes effect after restarting the Client

4 participants