Processes & Concurrency

RSS for tag

Discover how the operating system manages multiple applications and processes simultaneously, ensuring smooth multitasking performance.

Concurrency Documentation

Posts under Processes & Concurrency subtopic

Post

Replies

Boosts

Views

Activity

Processes & Concurrency Resources
General: DevForums subtopic: App & System Services > Processes & Concurrency Processes & concurrency covers a number of different technologies: Background Tasks Resources Concurrency Resources — This includes Swift concurrency. Service Management Resources XPC Resources Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
0
0
1.7k
Jul ’25
Does es_sync_client completion exclude a dropped final notification?
This is a public API contract question about macOS 27 EndpointSecurity, not a reported bug, observed loss, or tested reproducer. We need to distinguish draining messages admitted to a client queue from establishing that every relevant generated notification was delivered, including the final one. For this hypothetical case, assume one exact, nonnull client instance remains live in the same epoch throughout the request and callback. Its required subscriptions and unmuted scope have been verified. The sync call is made outside its ES handler; no client deletion, replacement, or cancellation occurs. A null-client immediate callback or a callback caused by destruction would not qualify. Also assume an ordered application writer has committed every record delivered to it; that receipt does not establish kernel completeness. Consider the following schematic sequence: A, the last numbered message, is received → an in-scope NOTIFY B may be generated and dropped → es_sync_client returns success and its callback completes → no subsequent numbered message is received. B represents a notification associated with an operation intended to precede the synchronization cut. Whether that operation's completion establishes B's enqueue position relative to the marker is part of the contract question, not an assumed scheduling guarantee. We understand the documented synchronous-enqueue relationship for completed syscalls. The sequence counters compare received messages, while WWDC20 also describes queue-full drops. We are not asserting that this hypothetical history occurs on any particular release. For an operation with the required pre-marker ordering established, does successful sync completion on the live client exclude a generated-but-dropped B, rather than only confirm processing of messages actually ahead of the marker in the queue? If it does not, is there a supported terminal sequence watermark, drop result, or equivalent interface that can establish loss-free delivery for that finite cut without waiting for another numbered notification? Which public contract specifies the required causal-ordering and client-lifecycle conditions, applicable macOS/SDK versions, and loss semantics—or, if this stronger guarantee is unavailable publicly, can you confirm the supported boundary? This question does not request global quiescence, termination of all descendants, private implementation details, or a workaround that weakens identity checks. References: es_sync_client global_seq_num seq_num WWDC20: Build an Endpoint Security app, 37:27
0
0
88
1d
macOS XPC: Authenticating the Exact Supervisor-Launched Child Process
I am developing a private, locally operated, single-user macOS application on Apple silicon. I need to establish a secure IPC boundary between a supervisor and a specific child process launched using posix_spawn. The requirement is to verify that a received XPC message originated from the exact child process instance launched by the supervisor, rather than another instance of the same signed executable. I have investigated the following public APIs: xpc_dictionary_get_remote_connection xpc_connection_get_pid xpc_connection_set_peer_code_signing_requirement xpc_peer_requirement_match_received_message SecCodeCreateWithXPCMessage Code-signing verification appears suitable for establishing executable identity. However, it does not necessarily distinguish two running instances of the same signed executable. PID comparison alone is also insufficient because of potential PID reuse and stale connection metadata. Additionally, the following interfaces were unavailable when compiling against my installed macOS SDK: xpc_connection_get_audit_token struct proc_uniqidentifierinfo PROC_PIDUNIQIDENTIFIERINFO My questions are: Is there a supported public macOS API for obtaining a kernel-authenticated, instance-specific identity for the sender of an actual XPC message? Can the supervisor independently obtain an equivalent trusted identity for its newly spawned child process and securely compare the two? Is there a documented process-lifetime guarantee or IPC architecture that can provide equivalent security without relying solely on PID matching, executable paths, or self-reported identifiers? If direct process-instance comparison is unsupported, what alternative architecture does Apple recommend? The objective is to authenticate both the signed executable identity and the specific authorized process instance responsible for the received message. I am specifically interested in documented public APIs and supported security guarantees, rather than private APIs or undocumented implementation behavior. Any guidance concerning the appropriate API sequence, required entitlements, or relevant documentation would be appreciated. Thank you.
0
0
72
3d
Can a sandboxed macOS app give each document job its own storage authority?
We’re building an offline document converter for Apple silicon with a minimum deployment target of macOS 14. The user selects a document in the main app. A bundled native worker should be able to process that job’s input and output, and should have no access to other jobs’ saved state. Two conversions can run at the same time. We tested an embedded XPC service with an App Sandbox entitlement and a bundle identifier separate from the client’s. On macOS 14.0 and 15.7.7, two concurrent clients and a third client started after they exited each received a different service PID. Foundation returned the same default Application Support location for all three service instances on each OS. The client had a different location. The sample queries each process’s own location and uses no customer documents. Apple’s XPC documentation describes the service process lifetime. Is there a public API available to a sandboxed Mac App Store app on Sonoma that gives a native worker storage access scoped to a single job, including concurrent jobs, and retires that access after the worker crashes? If so, which API or entitlement provides that guarantee, and how can the broker tell that the job has ended? If an embedded XPC service with a fixed identifier is unsuitable, is there a supported on-device architecture for this use case? Environment: Apple silicon, macOS 14.0 (23A344) and 15.7.7 (24G720). We can provide a small source-only Xcode project.
1
0
63
4d
macOS: Can an XPC audit token prove that a peer belongs to a specific launchd job instance?
I'm designing a security-sensitive macOS service using a protected launchd daemon and a separate bootstrap supervisor. The daemon's executable and launchd plist are intended to be protected from modification by unprivileged users. The job uses a SpawnConstraint to restrict which signed executable launchd may start. During the initial XPC handshake, the supervisor must determine whether the sender is the current process launched by one specific launchd job, rather than another independently started process running the same signed executable. I understand that: Spawn constraints restrict the executable that launchd may start. XPC peer code-signing requirements can authenticate a sender's code identity. A valid signature, Team ID, audit token or PID alone does not necessarily establish the sender's originating launchd job or current launch instance. My question: Is there a supported public macOS API or documented mechanism that allows a receiver to verify that the sender of an XPC message belongs to a specific launchd job label and its current launch instance, with OS-backed evidence rather than application-supplied claims? If not, is this association intentionally unavailable through public APIs? What architecture does Apple recommend when the receiver must distinguish a launchd-managed daemon from another process running the same signed executable? I'm particularly interested in avoiding PID-reuse races and avoiding the disclosure of authorization material before the peer is authenticated. I'm looking for a supported design, not private APIs or undocumented launchctl behavior. Thank you.
6
0
147
1w
Launching a signed AppKit app from a Python supervisor while preserving instance ownership and bounded cleanup
I'm looking for a supported way to launch a signed AppKit application for user interaction from a local Python supervisor, while retaining reliable supervision of the exact launched instance. Environment Apple M3 MacBook Air, macOS 14.5, build 23F79. arm64 app built with Command Line Tools clang and the macOS 14.5 SDK, targeting macOS 14.0. AppKit/Foundation with embedded CPython 3.12. Apple Development signing, hardened runtime and strict signature checks passed. Current launch and activation sequence The supervisor directly launches the bundle executable with Popen: a fixed argument, empty environment, new process session, disconnected stdin, and an anonymous stdout pipe carrying fixed, nonsecret startup markers. There is no LaunchServices foreground handoff. On its main thread, the app initializes NSApplication, confirms Regular activation policy, calls finishLaunching and activateIgnoringOtherApps:YES, then waits for isActive. Event-retrieval waits are capped at 20 ms; event dispatch itself may take longer. Existing timeout supervision remains active. Our activation guard is two seconds from the readiness routine's start, subject to the remaining native timer. A separate overall test budget is 300 seconds from operator readiness, before preflight. Observed result The latest test exited with code 1 after approximately 2.57 seconds. The validated markers were: absence.begin → absence.absent → fields.begin → ui.begin → app.shared.begin → app.shared.ready → policy.before → policy.already_regular → policy.postcondition → launch.finish.begin → launch.finish.ready → activation.requested → activation.wait.begin → stop.activation.timeoutThe final recorded state was: main=1 app=1 active=0 policy=0 window=0 visible=-1 key=-1The app stopped before constructing the dialog. Adding event processing did not resolve activation. We have not established why activation failed or which events were delivered. The two-second deadline is our guard, not an asserted macOS activation guarantee. Questions What supported launch and activation approach should this supervisor use for a foreground, interactive AppKit app? Can this direct-executable design be corrected narrowly, or should launching move to LaunchServices with a different communication and supervision arrangement? With the recommended approach, how should the supervisor identify the exact launched instance, receive startup status, enforce bounded termination, and establish that the process has exited before cleanup? We reviewed a simple foreground-launch substitution, but it did not preserve our existing marker pipe and authoritative exit/reap evidence. That is a limitation of our proposed adaptation, not a claim that Apple's APIs cannot support these outcomes. The essential requirements are exact-instance identification, nonsecret status reporting, bounded termination and verified cleanup. An anonymous pipe and direct-child waiting are current implementation choices, not requirements in themselves.
6
0
174
1w
TipKit crash on launch (iOS 27.2) — swift_unexpectedError with no app frames
We're seeing a crash from a user on iOS 27.2 that we can't reproduce locally. The crash shows swift_unexpectedError on the main thread with no application frames between the concurrency runtime and the crash. Our app binary hasn't changed since summer 2025 but this user started experiencing the crash for the first time about a week ago. Thread 0 (crashed): Thread 0 Crashed (com.apple.main-thread): 0 libswiftCore.dylib _assertionFailure(_:_:file:line:flags:) 1 libswiftCore.dylib swift_unexpectedError 2 libswift_Concurrency.dylib swift::runJobInEstablishedExecutorContext(...) 3 libswift_Concurrency.dylib swift_job_runImpl(...) 4 libdispatch.dylib _dispatch_main_queue_drain 5 libdispatch.dylib _dispatch_main_queue_callback_4CF 6 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ... (standard UIApplicationMain run loop)The crash occurs 0.45 seconds after launch. The only other active thread at the time of the crash is Thread 6, which shows TipKit driving SwiftData/CoreData work: Thread 6: Thread 6 name: Dispatch queue: NSManagedObjectContext 0x110f99500 0 CoreFoundation CFBasicHashGetPtrIndex 1 CoreFoundation CFBasicHashCreate 2 CoreFoundation CFDictionaryCreateMutable 3 CoreData _PFCMT_SetValue 4 CoreData -[NSManagedObjectContext _retainedObjectWithID:optionalHandler:withInlineStorage:] 5 CoreData -[NSManagedObjectContext objectWithID:] 6 SwiftData (SwiftData + 373080) 7 SwiftData (SwiftData + 281172) 8 SwiftData (SwiftData + 359244) 9 SwiftData (SwiftData + 355724) 10 SwiftData (SwiftData + 359208) 11 CoreData thunk for @callee_guaranteed () -> (@out A, @error @owned Error) 12 CoreData partial apply for thunk for @callee_guaranteed () -> (@out A, @error @owned Error) 13 CoreData NSManagedObjectContext._rethrowsHelper_performAndWait(...) 14 CoreData thunk for @callee_guaranteed @Sendable () -> () 15 CoreData thunk for @escaping @callee_guaranteed @Sendable () -> () 16 CoreData developerSubmittedBlockToNSManagedObjectContextPerform 17 libdispatch.dylib _dispatch_client_callout 18 libdispatch.dylib _dispatch_lane_barrier_sync_invoke_and_complete 19 CoreData -[NSManagedObjectContext performBlockAndWait:] 20 CoreData NSManagedObjectContext.performAndWait(_:) 21 SwiftData (SwiftData + 258584) 22 SwiftData (SwiftData + 257920) 23 SwiftData (SwiftData + 326480) 24 SwiftData (SwiftData + 259564) 25 SwiftData (SwiftData + 56292) 26 SwiftData (SwiftData + 385736) 27 TipKitCore (TipKitCore + 202216) 28 TipKitCore (TipKitCore + 128232) 29 TipKitCore (TipKitCore + 124104) 30 TipKitCore (TipKitCore + 130048) 31 TipKitCore (TipKitCore + 241553) 32 TipKitCore (TipKitCore + 152365) 33 TipKitCore (TipKitCore + 134441) 34 TipKitCore (TipKitCore + 152629) 35 TipKitCore (TipKitCore + 134233) 36 TipKitCore (TipKitCore + 134441) 37 TipKitCore (TipKitCore + 138237) 38 TipKitCore (TipKitCore + 134233) 39 libswift_Concurrency completeTask(swift::AsyncContext*, swift::SwiftError*)All other threads are idle. Context: We call try? Tips.configure([.displayFrequency(.hourly)]) early in our startup sequence. The try? should swallow any error from configure itself, but I'm not sure if TipKit spawns its own internal async tasks. Our app uses UIKit (not SwiftUI App lifecycle). We do not use SwiftData directly — any SwiftData/CoreData frames come from system frameworks. The binary hasn't changed since summer 2025, so this appears to be an OS-level regression on iOS 27.x. We cannot reproduce locally. Questions: Is there a way to get async backtraces in crash reports from the field, or is this only possible under the debugger? If TipKit spawns an internal Task that throws into a non-throwing context, would that produce exactly this crash pattern — swift_unexpectedError on the main thread with no third-party frames? Are there known issues with TipKit's internal SwiftData tasks crashing on iOS 27.x? Any guidance on narrowing this down without a local repro would be appreciated.
8
0
292
1w
Supported termination of a specific unresponsive embedded XPC service instance
We are evaluating a signed macOS launcher app with an embedded XPC service. The service would own a VZVirtualMachine. Before permitting VM startup, the launcher must bind the admitted job to the actual service instance and establish any required termination authority. We need clarification on the following: Is there a public, supported mechanism for the containing app to terminate that specific service instance if it becomes unresponsive, including before its first application-level reply? If so, what API, signing, sandbox, entitlement, and authorization conditions apply? How can the termination target remain bound to that instance despite PID reuse or service regeneration? Is transfer of a task-control right from the service to the launcher, followed by task_terminate, supported for this purpose? If it requires the service to respond first, is there a supported alternative for a pre-reply hang? What supported observation confirms termination of that same process instance, separately from acceptance of a termination request? What lifecycle behavior applies if the containing launcher itself terminates unexpectedly? We understand from threads 848542 and 850709 that Virtualization is expected to reclaim a guest after its owner exits, but provides neither a teardown timeline guarantee nor a successor-process guest-completion handle. We are not requesting such a guarantee or treating service exit as proof of completed VM reclamation. Please identify applicable documentation and any platform-version restrictions.
2
0
115
1w
Supported way for a watchOS clock app to stay frontmost after the screen dims?
I'm building a standalone watchOS app (SwiftUI, watch-only) whose main screen is its own full-screen clock. Users who choose this clock want it to remain the screen they see on wrist raise, instead of returning to the system watch face after the inactivity timeout. I'd like to know whether watchOS supports this for an App Store app, and which API to use. What I've looked at (watchOS 27.2 SDK, Xcode 27.2): Always On + Return to Clock. The app supports the Always On state. This works up to the Return to Clock interval the user chooses (at most one hour, per "Taking advantage of frontmost app state"). After that, the system face returns. WKApplication.isFrontmostTimeoutExtended. The documentation says it has had no effect since watchOS 7. In a test, reading it back gave false, and the app went to the background after about 2 minutes. WKExtendedRuntimeSession. The documentation asks developers to pick a session type based on the app's actual purpose (self care, mindfulness, physical therapy, smart alarm). None of these fits a clock, so I'm not using one to gain runtime. App Intents supportedModes / LongRunningIntent. These bring the app to the foreground when an intent runs, or run long background work. I couldn't find a way to use them to return automatically after the timeout. openSystemURL with the app's own URL scheme from a background callback. This didn't reopen the app. Other clock apps on the App Store offer a "keep active" style option, so I'm wondering whether a supported mechanism exists that I've missed. Questions: Is there a supported API or capability that lets a user-selected clock app stay frontmost, or come back automatically, after the inactivity timeout? Normal exits must still work: the Digital Crown, other apps, notifications, locking and Sleep Focus. If this isn't supported, is the limit intentional? Is per-app Return to Clock plus Always On the intended maximum? I can share a minimal sample (FrontmostClockProbe) that uses only public APIs and logs scene phase and luminance state. Thanks!
2
0
117
1w
Can a third-party iOS app automatically launch in the foreground at a scheduled time without user interaction?
Hello, I would like to clarify whether iOS provides any supported public API for automatically bringing a third-party app to the foreground at a scheduled time. The requirements are: The user has explicitly opted in to this behavior in advance. The app may be in the background, suspended, or not running. At a specified time, the app should automatically appear in the foreground without the user tapping a notification or performing any other action. The app should then automatically display and play media. Ideally, this should also work when the iPhone is locked. I understand that iOS has restrictions on background execution and that frameworks such as AlarmKit provide system-managed alarm experiences. My questions are: Is there any supported public API, entitlement, or combination of frameworks that enables this behavior? Can AlarmKit or another framework automatically launch a third-party app into the foreground without user interaction? If this is not supported, is it an intentional platform restriction? I am specifically asking about automatic foreground activation, not simply delivering a notification or running background tasks. Thank you for your guidance.
1
0
83
1w
Can macOS enforce a 512 MiB combined address-space cap before child code runs?
On Apple silicon macOS, is there a supported public mechanism that can enforce a hard combined mapped virtual address-space ceiling of 512 MiB for a parent process and its new child from the first charged creation step through loading the child's executable image, before the child runs any application code? The current investigation targets macOS build 26B123 on arm64. We need to know how the supported limit accounts for inherited maps, shared-region reservations and image mappings during process creation. If the supported route is to partition the ceiling between per-process limits, please specify whether the child limit applies before its first charged map and how a limit failure is reported. Please identify the public API or documentation, supported OS versions and required setup. A control that only applies to resident memory or starts after application code begins would not cover this question.
1
0
99
2w
How can a macOS observer verify child creation and reap after the spawning process exits?
On Apple silicon macOS 27.2 build 26B123, consider a launchd-managed supervisor making one posix_spawn call to start a dedicated worker. The supervisor may exit before receiving the PID or before it can wait for the child. Is there a supported API or OS-issued record that lets a surviving observer verify what happened to that one attempt? Can the observer distinguish an attempt that created no child from one that created a child before the caller received the PID? What stable identifier ties creation and any exec transition to that attempt? If the supervisor exits, which component actually performs the reap? Can the observer verify the same child's exit status, completed reap, and absence of surviving descendants after restarting? Please identify the supported macOS versions, privileges, record source, correlation fields, and any loss or retention limits. If no supported record covers a step, please identify that boundary.
0
0
134
2w
ExitTimeOut appears to be capped at 60 seconds, and ExitTimeOut 0 kills immediately
On macOS 27.x (Apple silicon) I've been measuring how launchd stops a job, and two behaviors don't match the documentation. Method: a throwaway job whose script traps SIGTERM and logs it, bootstrapped with different ExitTimeOut values, then stopped with launchctl bootout while timing when the process dies. Observed (LaunchAgent in the gui domain; the same results in the system domain with a LaunchDaemon): ExitTimeOut 45 -> `launchctl print` reports 45; SIGTERM, then SIGKILL at 45 s ExitTimeOut 61 -> reports 60; SIGTERM, then SIGKILL at 60 s ExitTimeOut 90 -> reports 60; SIGTERM, then SIGKILL at 60 s ExitTimeOut 120 -> reports 60; SIGTERM, then SIGKILL at 60 s ExitTimeOut 0 -> reports 0; SIGKILL after ~0.1 s, SIGTERM never deliveredman launchd.plist says of ExitTimeOut: "The amount of time launchd waits between sending the SIGTERM signal and before sending a SIGKILL signal when the job is to be stopped. The default value is system-defined. The value zero is interpreted as infinity and should not be used, as it can stall system shutdown forever." So: is there a 60-second ceiling on ExitTimeOut? It isn't documented that I can find, and it applies in both domains. And is zero meant to be "infinity" as documented, or an immediate SIGKILL as observed? Finally, is there a supported way for a service to be given more than 60 seconds to exit when launchd stops it — or is 60 seconds simply the maximum? Happy to file a Feedback with a minimal repro if that's useful.
7
0
338
3w
Title: Supported macOS PID reservation for an exited but unreaped direct child
Title: Supported macOS PID reservation for an exited but unreaped direct child I'm designing a process-lifecycle experiment on Apple silicon, initially targeting macOS 26.7.2 (build 25G332). A trusted parent directly launches a foreground child using posix_spawn(). The parent remains alive, exclusively owns reaping, preserves child exit status, and never sets SIGCHLD to SIG_IGN or enables SA_NOCLDWAIT. The parent may send kill(child_pid, SIGKILL) before obtaining the child's terminal status through waitpid(). POSIX.1-2008 §3.295 describes the PID as the last resource released when a process's lifetime ends. Section 4.13 prohibits PID reuse before that lifetime ends. Could Apple DTS clarify the supported macOS contract for this sequence? If the child exits immediately before the kill() call but remains unreaped, is its PID guaranteed not to be reassigned to another process while the original parent retains exclusive reaping authority? Does this guarantee apply to a child created through posix_spawn() on current Apple silicon macOS releases? Are there documented exceptions beyond automatic status disposal, competing reapers and parent termination? What result should the parent expect when kill() targets an already-exited but unreaped child? The design serialises signaling and reaping, and never signals the numeric PID after status consumption. This question concerns identity-safe signal targeting, not whether successful kill() establishes termination. The latter is separately verified using waitpid(). I'm seeking a supported API contract rather than empirical observations or private kernel implementation details. Thank you.
1
0
93
3w
iPadOS 26.4+ significantly reduced per-app memory limit from 6GB to 3GB on 8GB iPad, breaking memory-intensive apps
Summary: Starting from iPadOS 26.4, the maximum memory available to a single app has been reduced from approximately 6GB to 3GB on an 8GB iPad. This change persists in iPadOS 26.5 and has not been addressed. This breaks core functionality of memory-intensive applications such as 3D scanning apps that require large amounts of RAM to process models. Device: iPad with 8GB RAM Affected versions: iPadOS 26.4, iPadOS 26.5 Working version: iPadOS 26.0 / 26.1 / 26.2 / 26.3 Measured Data: iPadOS 26.0–26.3: App available memory ≈ 6GB (75% of total RAM) iPadOS 26.4–26.5: App available memory ≈ 3GB (37.5% of total RAM) Measurement method: Apple system API Impact: This is a regression, not expected behavior. The available memory per app has been cut by 50% without any official documentation or release notes mentioning this change. As a result, our 3D scanning application crashes immediately when attempting to process 3D models on iPadOS 26.4 and later. The app requires substantial RAM to load and process 3D model data. With only 3GB available, memory allocation fails during model processing, causing the app to crash (EXC_RESOURCE / OOM kill). This core functionality was working correctly on iPadOS 26.3 and earlier with the same device and same app binary. This regression makes our app's primary feature completely unusable for all users on iPadOS 26.4+. Steps to Reproduce: On an 8GB iPad, install iPadOS 26.0 Measure available app memory using Apple system API Upgrade to iPadOS 26.4 or 26.5 Measure available app memory again Observe: available memory drops from ~6GB to ~3GB Expected Result: Available memory per app should remain consistent across minor OS updates, or any changes should be documented. Actual Result: Available memory per app dropped by 50% starting in iPadOS 26.4, with no documentation of this change. Additional Notes: Disabling Apple Intelligence does not resolve the issue This issue was not fixed in iPadOS 26.5 Other developers have reported increased crash rates starting in iPadOS 26.4 (Apple Developer Forums)
18
1
4.0k
3w
iOS app running on macOS 27.0.1 terminated on suspension due to a Metal archiveUsage.db file lock (0xDEAD10CC)
Hello, We are investigating an issue where our iOS app, running as a “Designed for iPad” app on an Apple Silicon Mac, is terminated when it is suspended in the background. Environment OS: macOS 27.0.1 Hardware: Apple Silicon Mac App type: An iOS/iPadOS app running on Mac, rather than a separately developed macOS app The app uses Core Image’s CIContext to generate some image effects Steps to reproduce Launch the app on Mac and start playing a podcast. Move the app to the background. Start playback on another device. Our app’s cross-device playback coordination pauses playback on the Mac. After a short period, the Mac app is terminated. We have also observed similar termination after visiting a screen that uses Core Image image effects. Actual result The debugger reports: Terminated due to signal 9 RunningBoard logs indicate that the app was terminated with code 0xDEAD10CC because it was suspended while holding a disallowed shared file lock. The file identified in the log is: /var/folders/.../C/app.podcast.cosmos/app.podcast.cosmos/com.apple.metal/archiveUsage.db/lock.mdb The relevant log message includes: suspended while holding a shared file lock Investigation so far Using breakpoints on open and openat, we captured a call stack corresponding to: App creates a CIContext → Core Image CI::MetalContext → Metal recordBinaryArchiveUsage → archiveUsage.db/lock.mdb is opened We also tried: CIContext(options: [.useSoftwareRenderer: true]) However, in our test environment, we still observed Metal initialization and access to the relevant cache files. This option did not avoid the issue. For the gradient-mask generation code we had identified, we replaced the Core Image implementation with a CPU implementation using CGContext and CGGradient, avoiding CIContext creation on that path. After repeatedly testing the same reproduction steps, we could no longer reproduce the termination in that scenario. This suggests a connection to the Metal cache file lock accessed during Core Image initialization. However, we have not established the exact lifetime or internal owner of the lock, and we have not confirmed a thread deadlock. Questions Is this a known issue involving Core Image/Metal and suspension of iOS apps running on macOS 27.0.1? Why would a system-managed Metal cache file lock cause the app to be terminated with 0xDEAD10CC when suspended? Is there a recommended context configuration, resource cleanup procedure, or lifecycle handling approach that allows us to continue using Core Image safely in this environment?
1
0
103
3w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
1
0
205
3w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
0
0
99
3w
Pre-activation authorization and inactive connection cleanup for a launchd Mach service
I am evaluating the supported macOS C XPC lifecycle for a separately installed system-domain Mach service. This is a design/documentation question, not a reported crash or a tested OS-specific failure. Please identify applicable macOS/SDK versions and public API guarantees; no installed SDK capability is being assumed. The threat model includes an unprivileged process running as the worker's user. The OS and privileged administrator are trusted. Executables and role assignments would require independently protected approval. Matching a code signature alone is not intended to grant an issuer role. Two API boundaries affect whether the service can be authorized before activation: Binding an actual launch instance to protected enrollment. Is there a supported public API or enforceable launch-environment constraint that can distinguish an instance launched through an approved system-domain job/enrollment from direct invocation of the same approved executable? The required distinction is the actual job/executable launch transaction before service activation, not a process-provided label, PID/PPID lookup, copied install record, or signature alone. If launch constraints can enforce only a narrower property, what exactly is that property and its minimum supported version? If no public mechanism provides the stronger binding, confirmation of that limit would be useful. This question does not assume an XPC peer requirement can establish job origin or issuer authority. Disposing of a newly owned inactive connection after setup failure. Suppose xpc_connection_create_mach_service returns a caller-owned inactive client or listener, but preactivation policy setup then fails, for example xpc_connection_set_peer_code_signing_requirement returns an error. What is the documented safe cleanup sequence if transport activation has not been authorized? The xpc_connection_activate documentation warns that last-release of a created inactive connection is undefined. The cancellation documentation describes asynchronous unwinding, but I have not found an explicit exception for last-release of a never-activated, canceled object. Does a supported cancel/release sequence exist? If activation is required even for disposal, what effects can that cleanup activation cause and what guarantees apply? I am asking about a newly created owned object, not an incoming borrowed peer that a listener can reject by canceling and returning. Relevant references already consulted: https://developer.apple.com/documentation/xpc/xpc_connection_activate(_:) https://developer.apple.com/documentation/xpc/xpc_connection_cancel(_:) https://developer.apple.com/documentation/xpc/xpc_connection_set_event_handler(::) https://developer.apple.com/forums/thread/837286 (received-message checking versus initial outgoing delivery) An API reference, versioned contract, or explicit statement that either guarantee is unavailable would help determine the safe supported boundary. I am not requesting private APIs or a workaround that treats a caller assertion as authorization.
1
0
187
3w
What happens after BGContinuedProcessingTask "expires"?
If I create a BGContinuedProcessingTaskRequest, register it, and then "do work" within it appropriately reporting progress, and before my task has finished doing all the work it had to do, its expirationHandler triggers... does the task later try again? Or does it lose the execution opportunity until the app is next re-launched to the foreground? In my testing, I never saw my task execute again once expired (which suggests the latter?). I was able to easily force this expiry by starting my task, backgrounding my app, then launching the iOS Camera App. My example is just using test code inspired from https://developer.apple.com/documentation/backgroundtasks/performing-long-running-tasks-on-ios-and-ipados let request = BGContinuedProcessingTaskRequest(identifier: taskIdentifier, title: "Video Upload", subtitle: "Starting Upload") request.strategy = .queue BGTaskScheduler.shared.register(forTaskWithIdentifier: taskIdentifier, using: nil) { task in guard let task = task as? BGContinuedProcessingTask else { return } print("i am a good task") var wasExpired = false task.expirationHandler = { wasExpired = true } let progress = task.progress progress.totalUnitCount = 100 while !progress.isFinished && !wasExpired { progress.completedUnitCount += 1 let formattedProgress = String(format: "%.2f", progress.fractionCompleted * 100) task.updateTitle(task.title, subtitle: "Completed \(formattedProgress)%") sleep(1) } if progress.isFinished { print ("i was a good task") task.setTaskCompleted(success: true) } else { print("i was not a good task") task.setTaskCompleted(success: false) } } try? BGTaskScheduler.shared.submit(request) Apologies if this is clearly stated somewhere and I'm missing it.
5
0
686
4w
SecCodeCreateWithXPCMessage: sender identity across concurrent receives, exec, and deferred replies
I am evaluating a local macOS C XPC design. The target under consideration is macOS 27.0.1, build 26A434, on Apple silicon. This is a source-design question; I have not run a reproducer or established that the public source below matches that OS build. The public SecCode.h comment describes SecCodeCreateWithXPCMessage as obtaining a code reference for the sender of the supplied XPC message using associated audit identity. The implementation at Apple Security commit 97c3a4296c1ea06b0fe1877a7e616aa84450b5b2 obtains the dictionary's remote connection, takes that connection's audit token, and uses it for code lookup: https://github.com/apple-oss-distributions/Security/blob/97c3a4296c1ea06b0fe1877a7e616aa84450b5b2/OSX/libsecurity_codesigning/lib/SecCode.h https://github.com/apple-oss-distributions/Security/blob/97c3a4296c1ea06b0fe1877a7e616aa84450b5b2/OSX/libsecurity_codesigning/lib/SecCode.cpp Function anchor in both files: SecCodeCreateWithXPCMessage. I am treating this as a question about the supported API contract, not evidence of a vulnerability or proof of installed implementation. For an actual received C XPC dictionary M, retained for deferred processing, I need to understand the supported identity and reply guarantees: Does SecCodeCreateWithXPCMessage(M, ...) resolve audit identity fixed to M's original sender occurrence, or can the associated connection's identity at lookup time differ? In particular, what is guaranteed if another message arrives or processing occurs concurrently on another queue? If the sending process performs exec before the lookup, or after lookup but before a reply, what does the resulting SecCode reference identify? Is there a documented supported way to distinguish the original message-sending occurrence and executable from a later executable or replacement peer without using PID-based reconstruction or private XPC APIs? If I retain M and later use its supported C reply context, does the reply remain addressed to that same original sending occurrence? What are the documented effects of connection invalidation, exec, forwarding/delegation of relevant rights and outstanding aliases? I am not assuming that retaining M or the returned SecCode reference locks peer identity or revokes other holders. If these APIs do not jointly provide those guarantees, which public API and ownership pattern should a design use to validate the actual eventual reply recipient before sending sensitive data? A statement that a guarantee is unavailable or requires a different design would also help. Please distinguish C XPC behavior from Swift XPCReceivedMessage; I am not assuming an undocumented conversion between them. Could you point to the applicable documentation and supported macOS versions, and clarify whether the cited public source revision is representative of the target? If exact-build behavior cannot be established publicly, please identify that limitation. This question concerns transport identity and context lifetime only. A valid code identity would still need separate application authorization; I am not asking XPC to issue role, run or resource authority. I would prefer a documented contract over an inference from a successful test. I can prepare a separately scoped minimal example if one is necessary, but no executable example is included in this question.
5
0
246
Oct ’26
Processes & Concurrency Resources
General: DevForums subtopic: App & System Services > Processes & Concurrency Processes & concurrency covers a number of different technologies: Background Tasks Resources Concurrency Resources — This includes Swift concurrency. Service Management Resources XPC Resources Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = "eskimo" + "1" + "@" + "apple.com"
Replies
0
Boosts
0
Views
1.7k
Activity
Jul ’25
Does es_sync_client completion exclude a dropped final notification?
This is a public API contract question about macOS 27 EndpointSecurity, not a reported bug, observed loss, or tested reproducer. We need to distinguish draining messages admitted to a client queue from establishing that every relevant generated notification was delivered, including the final one. For this hypothetical case, assume one exact, nonnull client instance remains live in the same epoch throughout the request and callback. Its required subscriptions and unmuted scope have been verified. The sync call is made outside its ES handler; no client deletion, replacement, or cancellation occurs. A null-client immediate callback or a callback caused by destruction would not qualify. Also assume an ordered application writer has committed every record delivered to it; that receipt does not establish kernel completeness. Consider the following schematic sequence: A, the last numbered message, is received → an in-scope NOTIFY B may be generated and dropped → es_sync_client returns success and its callback completes → no subsequent numbered message is received. B represents a notification associated with an operation intended to precede the synchronization cut. Whether that operation's completion establishes B's enqueue position relative to the marker is part of the contract question, not an assumed scheduling guarantee. We understand the documented synchronous-enqueue relationship for completed syscalls. The sequence counters compare received messages, while WWDC20 also describes queue-full drops. We are not asserting that this hypothetical history occurs on any particular release. For an operation with the required pre-marker ordering established, does successful sync completion on the live client exclude a generated-but-dropped B, rather than only confirm processing of messages actually ahead of the marker in the queue? If it does not, is there a supported terminal sequence watermark, drop result, or equivalent interface that can establish loss-free delivery for that finite cut without waiting for another numbered notification? Which public contract specifies the required causal-ordering and client-lifecycle conditions, applicable macOS/SDK versions, and loss semantics—or, if this stronger guarantee is unavailable publicly, can you confirm the supported boundary? This question does not request global quiescence, termination of all descendants, private implementation details, or a workaround that weakens identity checks. References: es_sync_client global_seq_num seq_num WWDC20: Build an Endpoint Security app, 37:27
Replies
0
Boosts
0
Views
88
Activity
1d
macOS XPC: Authenticating the Exact Supervisor-Launched Child Process
I am developing a private, locally operated, single-user macOS application on Apple silicon. I need to establish a secure IPC boundary between a supervisor and a specific child process launched using posix_spawn. The requirement is to verify that a received XPC message originated from the exact child process instance launched by the supervisor, rather than another instance of the same signed executable. I have investigated the following public APIs: xpc_dictionary_get_remote_connection xpc_connection_get_pid xpc_connection_set_peer_code_signing_requirement xpc_peer_requirement_match_received_message SecCodeCreateWithXPCMessage Code-signing verification appears suitable for establishing executable identity. However, it does not necessarily distinguish two running instances of the same signed executable. PID comparison alone is also insufficient because of potential PID reuse and stale connection metadata. Additionally, the following interfaces were unavailable when compiling against my installed macOS SDK: xpc_connection_get_audit_token struct proc_uniqidentifierinfo PROC_PIDUNIQIDENTIFIERINFO My questions are: Is there a supported public macOS API for obtaining a kernel-authenticated, instance-specific identity for the sender of an actual XPC message? Can the supervisor independently obtain an equivalent trusted identity for its newly spawned child process and securely compare the two? Is there a documented process-lifetime guarantee or IPC architecture that can provide equivalent security without relying solely on PID matching, executable paths, or self-reported identifiers? If direct process-instance comparison is unsupported, what alternative architecture does Apple recommend? The objective is to authenticate both the signed executable identity and the specific authorized process instance responsible for the received message. I am specifically interested in documented public APIs and supported security guarantees, rather than private APIs or undocumented implementation behavior. Any guidance concerning the appropriate API sequence, required entitlements, or relevant documentation would be appreciated. Thank you.
Replies
0
Boosts
0
Views
72
Activity
3d
Can a sandboxed macOS app give each document job its own storage authority?
We’re building an offline document converter for Apple silicon with a minimum deployment target of macOS 14. The user selects a document in the main app. A bundled native worker should be able to process that job’s input and output, and should have no access to other jobs’ saved state. Two conversions can run at the same time. We tested an embedded XPC service with an App Sandbox entitlement and a bundle identifier separate from the client’s. On macOS 14.0 and 15.7.7, two concurrent clients and a third client started after they exited each received a different service PID. Foundation returned the same default Application Support location for all three service instances on each OS. The client had a different location. The sample queries each process’s own location and uses no customer documents. Apple’s XPC documentation describes the service process lifetime. Is there a public API available to a sandboxed Mac App Store app on Sonoma that gives a native worker storage access scoped to a single job, including concurrent jobs, and retires that access after the worker crashes? If so, which API or entitlement provides that guarantee, and how can the broker tell that the job has ended? If an embedded XPC service with a fixed identifier is unsuitable, is there a supported on-device architecture for this use case? Environment: Apple silicon, macOS 14.0 (23A344) and 15.7.7 (24G720). We can provide a small source-only Xcode project.
Replies
1
Boosts
0
Views
63
Activity
4d
macOS: Can an XPC audit token prove that a peer belongs to a specific launchd job instance?
I'm designing a security-sensitive macOS service using a protected launchd daemon and a separate bootstrap supervisor. The daemon's executable and launchd plist are intended to be protected from modification by unprivileged users. The job uses a SpawnConstraint to restrict which signed executable launchd may start. During the initial XPC handshake, the supervisor must determine whether the sender is the current process launched by one specific launchd job, rather than another independently started process running the same signed executable. I understand that: Spawn constraints restrict the executable that launchd may start. XPC peer code-signing requirements can authenticate a sender's code identity. A valid signature, Team ID, audit token or PID alone does not necessarily establish the sender's originating launchd job or current launch instance. My question: Is there a supported public macOS API or documented mechanism that allows a receiver to verify that the sender of an XPC message belongs to a specific launchd job label and its current launch instance, with OS-backed evidence rather than application-supplied claims? If not, is this association intentionally unavailable through public APIs? What architecture does Apple recommend when the receiver must distinguish a launchd-managed daemon from another process running the same signed executable? I'm particularly interested in avoiding PID-reuse races and avoiding the disclosure of authorization material before the peer is authenticated. I'm looking for a supported design, not private APIs or undocumented launchctl behavior. Thank you.
Replies
6
Boosts
0
Views
147
Activity
1w
Launching a signed AppKit app from a Python supervisor while preserving instance ownership and bounded cleanup
I'm looking for a supported way to launch a signed AppKit application for user interaction from a local Python supervisor, while retaining reliable supervision of the exact launched instance. Environment Apple M3 MacBook Air, macOS 14.5, build 23F79. arm64 app built with Command Line Tools clang and the macOS 14.5 SDK, targeting macOS 14.0. AppKit/Foundation with embedded CPython 3.12. Apple Development signing, hardened runtime and strict signature checks passed. Current launch and activation sequence The supervisor directly launches the bundle executable with Popen: a fixed argument, empty environment, new process session, disconnected stdin, and an anonymous stdout pipe carrying fixed, nonsecret startup markers. There is no LaunchServices foreground handoff. On its main thread, the app initializes NSApplication, confirms Regular activation policy, calls finishLaunching and activateIgnoringOtherApps:YES, then waits for isActive. Event-retrieval waits are capped at 20 ms; event dispatch itself may take longer. Existing timeout supervision remains active. Our activation guard is two seconds from the readiness routine's start, subject to the remaining native timer. A separate overall test budget is 300 seconds from operator readiness, before preflight. Observed result The latest test exited with code 1 after approximately 2.57 seconds. The validated markers were: absence.begin → absence.absent → fields.begin → ui.begin → app.shared.begin → app.shared.ready → policy.before → policy.already_regular → policy.postcondition → launch.finish.begin → launch.finish.ready → activation.requested → activation.wait.begin → stop.activation.timeoutThe final recorded state was: main=1 app=1 active=0 policy=0 window=0 visible=-1 key=-1The app stopped before constructing the dialog. Adding event processing did not resolve activation. We have not established why activation failed or which events were delivered. The two-second deadline is our guard, not an asserted macOS activation guarantee. Questions What supported launch and activation approach should this supervisor use for a foreground, interactive AppKit app? Can this direct-executable design be corrected narrowly, or should launching move to LaunchServices with a different communication and supervision arrangement? With the recommended approach, how should the supervisor identify the exact launched instance, receive startup status, enforce bounded termination, and establish that the process has exited before cleanup? We reviewed a simple foreground-launch substitution, but it did not preserve our existing marker pipe and authoritative exit/reap evidence. That is a limitation of our proposed adaptation, not a claim that Apple's APIs cannot support these outcomes. The essential requirements are exact-instance identification, nonsecret status reporting, bounded termination and verified cleanup. An anonymous pipe and direct-child waiting are current implementation choices, not requirements in themselves.
Replies
6
Boosts
0
Views
174
Activity
1w
TipKit crash on launch (iOS 27.2) — swift_unexpectedError with no app frames
We're seeing a crash from a user on iOS 27.2 that we can't reproduce locally. The crash shows swift_unexpectedError on the main thread with no application frames between the concurrency runtime and the crash. Our app binary hasn't changed since summer 2025 but this user started experiencing the crash for the first time about a week ago. Thread 0 (crashed): Thread 0 Crashed (com.apple.main-thread): 0 libswiftCore.dylib _assertionFailure(_:_:file:line:flags:) 1 libswiftCore.dylib swift_unexpectedError 2 libswift_Concurrency.dylib swift::runJobInEstablishedExecutorContext(...) 3 libswift_Concurrency.dylib swift_job_runImpl(...) 4 libdispatch.dylib _dispatch_main_queue_drain 5 libdispatch.dylib _dispatch_main_queue_callback_4CF 6 CoreFoundation __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ... (standard UIApplicationMain run loop)The crash occurs 0.45 seconds after launch. The only other active thread at the time of the crash is Thread 6, which shows TipKit driving SwiftData/CoreData work: Thread 6: Thread 6 name: Dispatch queue: NSManagedObjectContext 0x110f99500 0 CoreFoundation CFBasicHashGetPtrIndex 1 CoreFoundation CFBasicHashCreate 2 CoreFoundation CFDictionaryCreateMutable 3 CoreData _PFCMT_SetValue 4 CoreData -[NSManagedObjectContext _retainedObjectWithID:optionalHandler:withInlineStorage:] 5 CoreData -[NSManagedObjectContext objectWithID:] 6 SwiftData (SwiftData + 373080) 7 SwiftData (SwiftData + 281172) 8 SwiftData (SwiftData + 359244) 9 SwiftData (SwiftData + 355724) 10 SwiftData (SwiftData + 359208) 11 CoreData thunk for @callee_guaranteed () -> (@out A, @error @owned Error) 12 CoreData partial apply for thunk for @callee_guaranteed () -> (@out A, @error @owned Error) 13 CoreData NSManagedObjectContext._rethrowsHelper_performAndWait(...) 14 CoreData thunk for @callee_guaranteed @Sendable () -> () 15 CoreData thunk for @escaping @callee_guaranteed @Sendable () -> () 16 CoreData developerSubmittedBlockToNSManagedObjectContextPerform 17 libdispatch.dylib _dispatch_client_callout 18 libdispatch.dylib _dispatch_lane_barrier_sync_invoke_and_complete 19 CoreData -[NSManagedObjectContext performBlockAndWait:] 20 CoreData NSManagedObjectContext.performAndWait(_:) 21 SwiftData (SwiftData + 258584) 22 SwiftData (SwiftData + 257920) 23 SwiftData (SwiftData + 326480) 24 SwiftData (SwiftData + 259564) 25 SwiftData (SwiftData + 56292) 26 SwiftData (SwiftData + 385736) 27 TipKitCore (TipKitCore + 202216) 28 TipKitCore (TipKitCore + 128232) 29 TipKitCore (TipKitCore + 124104) 30 TipKitCore (TipKitCore + 130048) 31 TipKitCore (TipKitCore + 241553) 32 TipKitCore (TipKitCore + 152365) 33 TipKitCore (TipKitCore + 134441) 34 TipKitCore (TipKitCore + 152629) 35 TipKitCore (TipKitCore + 134233) 36 TipKitCore (TipKitCore + 134441) 37 TipKitCore (TipKitCore + 138237) 38 TipKitCore (TipKitCore + 134233) 39 libswift_Concurrency completeTask(swift::AsyncContext*, swift::SwiftError*)All other threads are idle. Context: We call try? Tips.configure([.displayFrequency(.hourly)]) early in our startup sequence. The try? should swallow any error from configure itself, but I'm not sure if TipKit spawns its own internal async tasks. Our app uses UIKit (not SwiftUI App lifecycle). We do not use SwiftData directly — any SwiftData/CoreData frames come from system frameworks. The binary hasn't changed since summer 2025, so this appears to be an OS-level regression on iOS 27.x. We cannot reproduce locally. Questions: Is there a way to get async backtraces in crash reports from the field, or is this only possible under the debugger? If TipKit spawns an internal Task that throws into a non-throwing context, would that produce exactly this crash pattern — swift_unexpectedError on the main thread with no third-party frames? Are there known issues with TipKit's internal SwiftData tasks crashing on iOS 27.x? Any guidance on narrowing this down without a local repro would be appreciated.
Replies
8
Boosts
0
Views
292
Activity
1w
Supported termination of a specific unresponsive embedded XPC service instance
We are evaluating a signed macOS launcher app with an embedded XPC service. The service would own a VZVirtualMachine. Before permitting VM startup, the launcher must bind the admitted job to the actual service instance and establish any required termination authority. We need clarification on the following: Is there a public, supported mechanism for the containing app to terminate that specific service instance if it becomes unresponsive, including before its first application-level reply? If so, what API, signing, sandbox, entitlement, and authorization conditions apply? How can the termination target remain bound to that instance despite PID reuse or service regeneration? Is transfer of a task-control right from the service to the launcher, followed by task_terminate, supported for this purpose? If it requires the service to respond first, is there a supported alternative for a pre-reply hang? What supported observation confirms termination of that same process instance, separately from acceptance of a termination request? What lifecycle behavior applies if the containing launcher itself terminates unexpectedly? We understand from threads 848542 and 850709 that Virtualization is expected to reclaim a guest after its owner exits, but provides neither a teardown timeline guarantee nor a successor-process guest-completion handle. We are not requesting such a guarantee or treating service exit as proof of completed VM reclamation. Please identify applicable documentation and any platform-version restrictions.
Replies
2
Boosts
0
Views
115
Activity
1w
Supported way for a watchOS clock app to stay frontmost after the screen dims?
I'm building a standalone watchOS app (SwiftUI, watch-only) whose main screen is its own full-screen clock. Users who choose this clock want it to remain the screen they see on wrist raise, instead of returning to the system watch face after the inactivity timeout. I'd like to know whether watchOS supports this for an App Store app, and which API to use. What I've looked at (watchOS 27.2 SDK, Xcode 27.2): Always On + Return to Clock. The app supports the Always On state. This works up to the Return to Clock interval the user chooses (at most one hour, per "Taking advantage of frontmost app state"). After that, the system face returns. WKApplication.isFrontmostTimeoutExtended. The documentation says it has had no effect since watchOS 7. In a test, reading it back gave false, and the app went to the background after about 2 minutes. WKExtendedRuntimeSession. The documentation asks developers to pick a session type based on the app's actual purpose (self care, mindfulness, physical therapy, smart alarm). None of these fits a clock, so I'm not using one to gain runtime. App Intents supportedModes / LongRunningIntent. These bring the app to the foreground when an intent runs, or run long background work. I couldn't find a way to use them to return automatically after the timeout. openSystemURL with the app's own URL scheme from a background callback. This didn't reopen the app. Other clock apps on the App Store offer a "keep active" style option, so I'm wondering whether a supported mechanism exists that I've missed. Questions: Is there a supported API or capability that lets a user-selected clock app stay frontmost, or come back automatically, after the inactivity timeout? Normal exits must still work: the Digital Crown, other apps, notifications, locking and Sleep Focus. If this isn't supported, is the limit intentional? Is per-app Return to Clock plus Always On the intended maximum? I can share a minimal sample (FrontmostClockProbe) that uses only public APIs and logs scene phase and luminance state. Thanks!
Replies
2
Boosts
0
Views
117
Activity
1w
Can a third-party iOS app automatically launch in the foreground at a scheduled time without user interaction?
Hello, I would like to clarify whether iOS provides any supported public API for automatically bringing a third-party app to the foreground at a scheduled time. The requirements are: The user has explicitly opted in to this behavior in advance. The app may be in the background, suspended, or not running. At a specified time, the app should automatically appear in the foreground without the user tapping a notification or performing any other action. The app should then automatically display and play media. Ideally, this should also work when the iPhone is locked. I understand that iOS has restrictions on background execution and that frameworks such as AlarmKit provide system-managed alarm experiences. My questions are: Is there any supported public API, entitlement, or combination of frameworks that enables this behavior? Can AlarmKit or another framework automatically launch a third-party app into the foreground without user interaction? If this is not supported, is it an intentional platform restriction? I am specifically asking about automatic foreground activation, not simply delivering a notification or running background tasks. Thank you for your guidance.
Replies
1
Boosts
0
Views
83
Activity
1w
Can macOS enforce a 512 MiB combined address-space cap before child code runs?
On Apple silicon macOS, is there a supported public mechanism that can enforce a hard combined mapped virtual address-space ceiling of 512 MiB for a parent process and its new child from the first charged creation step through loading the child's executable image, before the child runs any application code? The current investigation targets macOS build 26B123 on arm64. We need to know how the supported limit accounts for inherited maps, shared-region reservations and image mappings during process creation. If the supported route is to partition the ceiling between per-process limits, please specify whether the child limit applies before its first charged map and how a limit failure is reported. Please identify the public API or documentation, supported OS versions and required setup. A control that only applies to resident memory or starts after application code begins would not cover this question.
Replies
1
Boosts
0
Views
99
Activity
2w
How can a macOS observer verify child creation and reap after the spawning process exits?
On Apple silicon macOS 27.2 build 26B123, consider a launchd-managed supervisor making one posix_spawn call to start a dedicated worker. The supervisor may exit before receiving the PID or before it can wait for the child. Is there a supported API or OS-issued record that lets a surviving observer verify what happened to that one attempt? Can the observer distinguish an attempt that created no child from one that created a child before the caller received the PID? What stable identifier ties creation and any exec transition to that attempt? If the supervisor exits, which component actually performs the reap? Can the observer verify the same child's exit status, completed reap, and absence of surviving descendants after restarting? Please identify the supported macOS versions, privileges, record source, correlation fields, and any loss or retention limits. If no supported record covers a step, please identify that boundary.
Replies
0
Boosts
0
Views
134
Activity
2w
ExitTimeOut appears to be capped at 60 seconds, and ExitTimeOut 0 kills immediately
On macOS 27.x (Apple silicon) I've been measuring how launchd stops a job, and two behaviors don't match the documentation. Method: a throwaway job whose script traps SIGTERM and logs it, bootstrapped with different ExitTimeOut values, then stopped with launchctl bootout while timing when the process dies. Observed (LaunchAgent in the gui domain; the same results in the system domain with a LaunchDaemon): ExitTimeOut 45 -> `launchctl print` reports 45; SIGTERM, then SIGKILL at 45 s ExitTimeOut 61 -> reports 60; SIGTERM, then SIGKILL at 60 s ExitTimeOut 90 -> reports 60; SIGTERM, then SIGKILL at 60 s ExitTimeOut 120 -> reports 60; SIGTERM, then SIGKILL at 60 s ExitTimeOut 0 -> reports 0; SIGKILL after ~0.1 s, SIGTERM never deliveredman launchd.plist says of ExitTimeOut: "The amount of time launchd waits between sending the SIGTERM signal and before sending a SIGKILL signal when the job is to be stopped. The default value is system-defined. The value zero is interpreted as infinity and should not be used, as it can stall system shutdown forever." So: is there a 60-second ceiling on ExitTimeOut? It isn't documented that I can find, and it applies in both domains. And is zero meant to be "infinity" as documented, or an immediate SIGKILL as observed? Finally, is there a supported way for a service to be given more than 60 seconds to exit when launchd stops it — or is 60 seconds simply the maximum? Happy to file a Feedback with a minimal repro if that's useful.
Replies
7
Boosts
0
Views
338
Activity
3w
Title: Supported macOS PID reservation for an exited but unreaped direct child
Title: Supported macOS PID reservation for an exited but unreaped direct child I'm designing a process-lifecycle experiment on Apple silicon, initially targeting macOS 26.7.2 (build 25G332). A trusted parent directly launches a foreground child using posix_spawn(). The parent remains alive, exclusively owns reaping, preserves child exit status, and never sets SIGCHLD to SIG_IGN or enables SA_NOCLDWAIT. The parent may send kill(child_pid, SIGKILL) before obtaining the child's terminal status through waitpid(). POSIX.1-2008 §3.295 describes the PID as the last resource released when a process's lifetime ends. Section 4.13 prohibits PID reuse before that lifetime ends. Could Apple DTS clarify the supported macOS contract for this sequence? If the child exits immediately before the kill() call but remains unreaped, is its PID guaranteed not to be reassigned to another process while the original parent retains exclusive reaping authority? Does this guarantee apply to a child created through posix_spawn() on current Apple silicon macOS releases? Are there documented exceptions beyond automatic status disposal, competing reapers and parent termination? What result should the parent expect when kill() targets an already-exited but unreaped child? The design serialises signaling and reaping, and never signals the numeric PID after status consumption. This question concerns identity-safe signal targeting, not whether successful kill() establishes termination. The latter is separately verified using waitpid(). I'm seeking a supported API contract rather than empirical observations or private kernel implementation details. Thank you.
Replies
1
Boosts
0
Views
93
Activity
3w
iPadOS 26.4+ significantly reduced per-app memory limit from 6GB to 3GB on 8GB iPad, breaking memory-intensive apps
Summary: Starting from iPadOS 26.4, the maximum memory available to a single app has been reduced from approximately 6GB to 3GB on an 8GB iPad. This change persists in iPadOS 26.5 and has not been addressed. This breaks core functionality of memory-intensive applications such as 3D scanning apps that require large amounts of RAM to process models. Device: iPad with 8GB RAM Affected versions: iPadOS 26.4, iPadOS 26.5 Working version: iPadOS 26.0 / 26.1 / 26.2 / 26.3 Measured Data: iPadOS 26.0–26.3: App available memory ≈ 6GB (75% of total RAM) iPadOS 26.4–26.5: App available memory ≈ 3GB (37.5% of total RAM) Measurement method: Apple system API Impact: This is a regression, not expected behavior. The available memory per app has been cut by 50% without any official documentation or release notes mentioning this change. As a result, our 3D scanning application crashes immediately when attempting to process 3D models on iPadOS 26.4 and later. The app requires substantial RAM to load and process 3D model data. With only 3GB available, memory allocation fails during model processing, causing the app to crash (EXC_RESOURCE / OOM kill). This core functionality was working correctly on iPadOS 26.3 and earlier with the same device and same app binary. This regression makes our app's primary feature completely unusable for all users on iPadOS 26.4+. Steps to Reproduce: On an 8GB iPad, install iPadOS 26.0 Measure available app memory using Apple system API Upgrade to iPadOS 26.4 or 26.5 Measure available app memory again Observe: available memory drops from ~6GB to ~3GB Expected Result: Available memory per app should remain consistent across minor OS updates, or any changes should be documented. Actual Result: Available memory per app dropped by 50% starting in iPadOS 26.4, with no documentation of this change. Additional Notes: Disabling Apple Intelligence does not resolve the issue This issue was not fixed in iPadOS 26.5 Other developers have reported increased crash rates starting in iPadOS 26.4 (Apple Developer Forums)
Replies
18
Boosts
1
Views
4.0k
Activity
3w
iOS app running on macOS 27.0.1 terminated on suspension due to a Metal archiveUsage.db file lock (0xDEAD10CC)
Hello, We are investigating an issue where our iOS app, running as a “Designed for iPad” app on an Apple Silicon Mac, is terminated when it is suspended in the background. Environment OS: macOS 27.0.1 Hardware: Apple Silicon Mac App type: An iOS/iPadOS app running on Mac, rather than a separately developed macOS app The app uses Core Image’s CIContext to generate some image effects Steps to reproduce Launch the app on Mac and start playing a podcast. Move the app to the background. Start playback on another device. Our app’s cross-device playback coordination pauses playback on the Mac. After a short period, the Mac app is terminated. We have also observed similar termination after visiting a screen that uses Core Image image effects. Actual result The debugger reports: Terminated due to signal 9 RunningBoard logs indicate that the app was terminated with code 0xDEAD10CC because it was suspended while holding a disallowed shared file lock. The file identified in the log is: /var/folders/.../C/app.podcast.cosmos/app.podcast.cosmos/com.apple.metal/archiveUsage.db/lock.mdb The relevant log message includes: suspended while holding a shared file lock Investigation so far Using breakpoints on open and openat, we captured a call stack corresponding to: App creates a CIContext → Core Image CI::MetalContext → Metal recordBinaryArchiveUsage → archiveUsage.db/lock.mdb is opened We also tried: CIContext(options: [.useSoftwareRenderer: true]) However, in our test environment, we still observed Metal initialization and access to the relevant cache files. This option did not avoid the issue. For the gradient-mask generation code we had identified, we replaced the Core Image implementation with a CPU implementation using CGContext and CGGradient, avoiding CIContext creation on that path. After repeatedly testing the same reproduction steps, we could no longer reproduce the termination in that scenario. This suggests a connection to the Metal cache file lock accessed during Core Image initialization. However, we have not established the exact lifetime or internal owner of the lock, and we have not confirmed a thread deadlock. Questions Is this a known issue involving Core Image/Metal and suspension of iOS apps running on macOS 27.0.1? Why would a system-managed Metal cache file lock cause the app to be terminated with 0xDEAD10CC when suspended? Is there a recommended context configuration, resource cleanup procedure, or lifecycle handling approach that allows us to continue using Core Image safely in this environment?
Replies
1
Boosts
0
Views
103
Activity
3w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
Replies
1
Boosts
0
Views
205
Activity
3w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
Replies
0
Boosts
0
Views
99
Activity
3w
Pre-activation authorization and inactive connection cleanup for a launchd Mach service
I am evaluating the supported macOS C XPC lifecycle for a separately installed system-domain Mach service. This is a design/documentation question, not a reported crash or a tested OS-specific failure. Please identify applicable macOS/SDK versions and public API guarantees; no installed SDK capability is being assumed. The threat model includes an unprivileged process running as the worker's user. The OS and privileged administrator are trusted. Executables and role assignments would require independently protected approval. Matching a code signature alone is not intended to grant an issuer role. Two API boundaries affect whether the service can be authorized before activation: Binding an actual launch instance to protected enrollment. Is there a supported public API or enforceable launch-environment constraint that can distinguish an instance launched through an approved system-domain job/enrollment from direct invocation of the same approved executable? The required distinction is the actual job/executable launch transaction before service activation, not a process-provided label, PID/PPID lookup, copied install record, or signature alone. If launch constraints can enforce only a narrower property, what exactly is that property and its minimum supported version? If no public mechanism provides the stronger binding, confirmation of that limit would be useful. This question does not assume an XPC peer requirement can establish job origin or issuer authority. Disposing of a newly owned inactive connection after setup failure. Suppose xpc_connection_create_mach_service returns a caller-owned inactive client or listener, but preactivation policy setup then fails, for example xpc_connection_set_peer_code_signing_requirement returns an error. What is the documented safe cleanup sequence if transport activation has not been authorized? The xpc_connection_activate documentation warns that last-release of a created inactive connection is undefined. The cancellation documentation describes asynchronous unwinding, but I have not found an explicit exception for last-release of a never-activated, canceled object. Does a supported cancel/release sequence exist? If activation is required even for disposal, what effects can that cleanup activation cause and what guarantees apply? I am asking about a newly created owned object, not an incoming borrowed peer that a listener can reject by canceling and returning. Relevant references already consulted: https://developer.apple.com/documentation/xpc/xpc_connection_activate(_:) https://developer.apple.com/documentation/xpc/xpc_connection_cancel(_:) https://developer.apple.com/documentation/xpc/xpc_connection_set_event_handler(::) https://developer.apple.com/forums/thread/837286 (received-message checking versus initial outgoing delivery) An API reference, versioned contract, or explicit statement that either guarantee is unavailable would help determine the safe supported boundary. I am not requesting private APIs or a workaround that treats a caller assertion as authorization.
Replies
1
Boosts
0
Views
187
Activity
3w
What happens after BGContinuedProcessingTask "expires"?
If I create a BGContinuedProcessingTaskRequest, register it, and then "do work" within it appropriately reporting progress, and before my task has finished doing all the work it had to do, its expirationHandler triggers... does the task later try again? Or does it lose the execution opportunity until the app is next re-launched to the foreground? In my testing, I never saw my task execute again once expired (which suggests the latter?). I was able to easily force this expiry by starting my task, backgrounding my app, then launching the iOS Camera App. My example is just using test code inspired from https://developer.apple.com/documentation/backgroundtasks/performing-long-running-tasks-on-ios-and-ipados let request = BGContinuedProcessingTaskRequest(identifier: taskIdentifier, title: "Video Upload", subtitle: "Starting Upload") request.strategy = .queue BGTaskScheduler.shared.register(forTaskWithIdentifier: taskIdentifier, using: nil) { task in guard let task = task as? BGContinuedProcessingTask else { return } print("i am a good task") var wasExpired = false task.expirationHandler = { wasExpired = true } let progress = task.progress progress.totalUnitCount = 100 while !progress.isFinished && !wasExpired { progress.completedUnitCount += 1 let formattedProgress = String(format: "%.2f", progress.fractionCompleted * 100) task.updateTitle(task.title, subtitle: "Completed \(formattedProgress)%") sleep(1) } if progress.isFinished { print ("i was a good task") task.setTaskCompleted(success: true) } else { print("i was not a good task") task.setTaskCompleted(success: false) } } try? BGTaskScheduler.shared.submit(request) Apologies if this is clearly stated somewhere and I'm missing it.
Replies
5
Boosts
0
Views
686
Activity
4w
SecCodeCreateWithXPCMessage: sender identity across concurrent receives, exec, and deferred replies
I am evaluating a local macOS C XPC design. The target under consideration is macOS 27.0.1, build 26A434, on Apple silicon. This is a source-design question; I have not run a reproducer or established that the public source below matches that OS build. The public SecCode.h comment describes SecCodeCreateWithXPCMessage as obtaining a code reference for the sender of the supplied XPC message using associated audit identity. The implementation at Apple Security commit 97c3a4296c1ea06b0fe1877a7e616aa84450b5b2 obtains the dictionary's remote connection, takes that connection's audit token, and uses it for code lookup: https://github.com/apple-oss-distributions/Security/blob/97c3a4296c1ea06b0fe1877a7e616aa84450b5b2/OSX/libsecurity_codesigning/lib/SecCode.h https://github.com/apple-oss-distributions/Security/blob/97c3a4296c1ea06b0fe1877a7e616aa84450b5b2/OSX/libsecurity_codesigning/lib/SecCode.cpp Function anchor in both files: SecCodeCreateWithXPCMessage. I am treating this as a question about the supported API contract, not evidence of a vulnerability or proof of installed implementation. For an actual received C XPC dictionary M, retained for deferred processing, I need to understand the supported identity and reply guarantees: Does SecCodeCreateWithXPCMessage(M, ...) resolve audit identity fixed to M's original sender occurrence, or can the associated connection's identity at lookup time differ? In particular, what is guaranteed if another message arrives or processing occurs concurrently on another queue? If the sending process performs exec before the lookup, or after lookup but before a reply, what does the resulting SecCode reference identify? Is there a documented supported way to distinguish the original message-sending occurrence and executable from a later executable or replacement peer without using PID-based reconstruction or private XPC APIs? If I retain M and later use its supported C reply context, does the reply remain addressed to that same original sending occurrence? What are the documented effects of connection invalidation, exec, forwarding/delegation of relevant rights and outstanding aliases? I am not assuming that retaining M or the returned SecCode reference locks peer identity or revokes other holders. If these APIs do not jointly provide those guarantees, which public API and ownership pattern should a design use to validate the actual eventual reply recipient before sending sensitive data? A statement that a guarantee is unavailable or requires a different design would also help. Please distinguish C XPC behavior from Swift XPCReceivedMessage; I am not assuming an undocumented conversion between them. Could you point to the applicable documentation and supported macOS versions, and clarify whether the cited public source revision is representative of the target? If exact-build behavior cannot be established publicly, please identify that limitation. This question concerns transport identity and context lifetime only. A valid code identity would still need separate application authorization; I am not asking XPC to issue role, run or resource authority. I would prefer a documented contract over an inference from a successful test. I can prepare a separately scoped minimal example if one is necessary, but no executable example is included in this question.
Replies
5
Boosts
0
Views
246
Activity
Oct ’26