From ac7aaf820c1e4ccafeb76edb45ca5bc4ae6a8ef9 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 18:11:45 +1030 Subject: [PATCH] fix(apple): move reset command to work queue (#10707) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes [APPLE-CLIENT-7S](https://sentry.io/organizations/firezone-inc/issues/6812982801/). The issue was that: Synchronous access to `Adapter.systemConfigurationResolvers` during concurrent deallocation causes an EXC_BAD_ACCESS crash. - Moves the `reset` command execution to the `workQueue` to prevent potential deadlocks or race conditions when accessing shared resources or interacting with the network extension's internal state. This fix was generated by Seer in Sentry, triggered by jamil@firezone.dev. 👁️ Run ID: 2183818 Not quite right? [Click here to continue debugging with Seer.](https://sentry.io/organizations/firezone-inc/issues/6812982801/?seerDrawer=true) Fixes #10195 --------- Co-authored-by: seer-by-sentry[bot] <157164994+seer-by-sentry[bot]@users.noreply.github.com> Co-authored-by: Mariusz Klochowicz Co-authored-by: Jamil --- swift/apple/FirezoneNetworkExtension/Adapter.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/swift/apple/FirezoneNetworkExtension/Adapter.swift b/swift/apple/FirezoneNetworkExtension/Adapter.swift index e4993a9fc..a9b1336f6 100644 --- a/swift/apple/FirezoneNetworkExtension/Adapter.swift +++ b/swift/apple/FirezoneNetworkExtension/Adapter.swift @@ -319,10 +319,13 @@ class Adapter: @unchecked Sendable { } func reset(reason: String, path: Network.NWPath? = nil) { - sendCommand(.reset(reason)) + workQueue.async { [weak self] in + guard let self = self else { return } + self.sendCommand(.reset(reason)) - if let path = (path ?? lastPath) { - setSystemDefaultResolvers(path) + if let path = (path ?? self.lastPath) { + self.setSystemDefaultResolvers(path) + } } }