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
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
111
20h
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
130
1d
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
249
1d
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
73
1d
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
81
3d
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
61
5d
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
92
1w
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
127
1w
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
315
2w
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
79
2w
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
3.9k
2w
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
95
2w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
1
0
186
2w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
0
0
85
2w
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
167
2w
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
663
3w
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
235
3w
Title: Supported OS-enforced restriction of Keychain access while retaining App Sandbox and App Group UDS
I’m designing a small, controlled macOS test harness. Two separately signed, sandboxed applications communicate through a UNIX-domain socket in an App Group container. They run as non-root processes in a GUI user session. One application also launches a child that inherits its sandbox and an existing socket descriptor. Is there a documented, supported OS policy that preserves this IPC arrangement while preventing the test processes from retrieving, using or modifying credentials, including items in their own Data Protection Keychain access groups and reachable file-based keychains? The policy must also prevent creating credential stores/items outside the permitted test resources. Using a macOS-style TeamID-prefixed App Group avoids that group providing Keychain sharing, but does not establish denial of the remaining Keychain operations. Empty stores, avoiding API calls and relying on users refusing prompts are insufficient for this requirement. If a different execution context or isolation architecture is required, could you identify the supported mechanism and relevant documentation? I’m seeking platform guidance, without relying on private APIs or unsupported custom sandbox profiles.
3
0
348
3w
Supported diagnosis for posix_spawn EPERM when launching a sandboxed local QA host
On macOS 15.7.9 (24G830), arm64, using Xcode 16.4 (16F6), a locally built QA host fails to launch through LaunchServices using open -W. The recorded signature is ad hoc, with no TeamIdentifier; its only recorded effective entitlement is com.apple.security.app-sandbox=true. The historical launch returned -10810. Correlated logs report posix_spawn: Operation not permitted (errno 1). Host entry was not observed. A packaging revision embedded the same Info.plist in __TEXT,__info_plist. Recorded signature verification succeeded, but the next launch produced the same rejection. The responsible policy remains unidentified; these observations are not an independently validated minimal reproducer. What supported diagnostic procedure can identify the policy responsible for this rejection without disabling security protections or using an alternative launch route?
1
0
226
3w
Keeping every descendant of a sandboxed XPC service’s worker inside its lifetime (fork, double-fork, setsid)
Apple DTS case 22893354: forum post and reply Apple asked for the question as a Developer Forums post, then a reply to the case email with the post URL. Nothing below has been posted or sent. 1. Forum post Post at https://developer.apple.com/forums/ (signed in, "Ask a question"). Suggested tags: XPC, App Sandbox, Endpoint Security Attach: fixtures/egress_guard/hp04/apple-descendant-sample/main.c, renamed to main.txt if the forum refuses .c. Title Keeping every descendant of a sandboxed XPC service's worker inside its lifetime (fork, double-fork, setsid) Body We are designing a macOS app that runs an unmodified third-party command-line tool for one task at a time. The plan is an app-bundled, sandboxed XPC service that launches the tool as a child process. The tool is not ours, so we have to assume it may fork without exec, double-fork, and call setsid(). For each run we need one guarantee: after the run ends, every process the tool created has stopped. "Ends" includes the XPC service crashing and the host app crashing, not only a clean cancel. If we cannot prove that, we cannot report the run as finished. What we have looked at so far: Killing the process group. A child that calls setsid() is no longer in the group. launchd's process-group cleanup for the job. As we read launchd.plist(5), that also covers the process group only. Tracking pids from fork and exit notifications, including Endpoint Security. Notifications can be dropped, and pids can be reused, so a list rebuilt from events is not proof that nothing is left. The attached sample shows the process shape without any sandbox or XPC. It starts a worker, the worker double-forks, and the grandchild calls setsid() and keeps writing to a log after the original process has exited. On macOS 15.6.1 the descendant shows parent pid 1 and its own session, and it keeps writing until it finishes on its own: // worker: fork twice, let the intermediate processes exit if (fork() > 0) _exit(0); if (fork() > 0) _exit(0); setsid(); // leaves the original process group and session for (int i = 0; i < 8; i++) { // append "tick i pid ppid" to the log, ppid is now 1 usleep(200000); }Build with cc -Wall -Wextra -Werror -o DescendantOutlivesParent main.c and run ./DescendantOutlivesParent /tmp/descendant-log /tmp/descendant-ready. Questions: Is there a supported mechanism that ties every descendant of a process started by an XPC service, including ones that called setsid(), to the lifetime of that service, so that they are terminated when the service exits or crashes? If the service is sandboxed, does sandbox inheritance (children inherit the parent's sandbox) also give us a way to find or terminate those descendants, or does it only restrict what they can do? If neither, what does Apple recommend for running an untrusted command-line tool where leftover descendants must be ruled out? For example, is a separate launchd job per run, a different process-management API, or Endpoint Security authorization the intended route? Can that mechanism be combined with per-run file access (one input folder and one scratch folder per run), without giving the tool a shared container or network access? We would rather learn that a guarantee is not available than build on an assumption, so a "this is not supported" answer is also useful to us. 2. Reply to the DTS email Reply to Apple's case email (keep the subject) after the post is live: Case-ID: 22893354 Hello, Thank you. I posted the question on the Developer Forums here: <FORUM POST URL> The sample project is attached to the post. There is nothing private in it. Best regards, <NAME>
1
0
186
3w
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
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
111
Activity
20h
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
130
Activity
1d
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
249
Activity
1d
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
73
Activity
1d
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
81
Activity
3d
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
61
Activity
5d
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
92
Activity
1w
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
127
Activity
1w
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
315
Activity
2w
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
79
Activity
2w
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
3.9k
Activity
2w
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
95
Activity
2w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
Replies
1
Boosts
0
Views
186
Activity
2w
有运算密集型的任务需要运行较长时间,用户在前台触发后不希望一直在前台等待任务完成,希望在后台持续运行并且有较高的CPU优先级,在前台轻负载情况下让这个后台任务性能保持和前台时接近的性能和时延,请问iOS上有这样的方案吗?
需要满足 (1)后台保活,在后台时任务仍然能一直运行直到任务完成 (2)任务在后台运行时,且前台负载较低时让任务分配尽量多的CPU资源,保持任务的性能和前台时接近 (3)需要使用GPU和NPU,需要跑AI模型,如果可以用GPU就更好,(GPU不跑也行) (4)方案合法,能上架苹果APP Store. 可以通过蓝牙连接来进行后台保活,这个任务本身就需要通过蓝牙连接一个外设,但是这种保活方式任务在后台时CPU权限较低,性能时延劣化很严重。 任务本身是类似做图片/视频处理的任务,需要跑几秒到几分钟的量级,最好可以尽量多地跑久一些。 我们试过了,后台保活后性能都大幅下降,降了6~10倍,体验较差 有没有做过类似的后台任务的,最终做到前后台性能接近的(前台空负载时)?
Replies
0
Boosts
0
Views
85
Activity
2w
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
167
Activity
2w
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
663
Activity
3w
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
235
Activity
3w
Title: Supported OS-enforced restriction of Keychain access while retaining App Sandbox and App Group UDS
I’m designing a small, controlled macOS test harness. Two separately signed, sandboxed applications communicate through a UNIX-domain socket in an App Group container. They run as non-root processes in a GUI user session. One application also launches a child that inherits its sandbox and an existing socket descriptor. Is there a documented, supported OS policy that preserves this IPC arrangement while preventing the test processes from retrieving, using or modifying credentials, including items in their own Data Protection Keychain access groups and reachable file-based keychains? The policy must also prevent creating credential stores/items outside the permitted test resources. Using a macOS-style TeamID-prefixed App Group avoids that group providing Keychain sharing, but does not establish denial of the remaining Keychain operations. Empty stores, avoiding API calls and relying on users refusing prompts are insufficient for this requirement. If a different execution context or isolation architecture is required, could you identify the supported mechanism and relevant documentation? I’m seeking platform guidance, without relying on private APIs or unsupported custom sandbox profiles.
Replies
3
Boosts
0
Views
348
Activity
3w
Supported diagnosis for posix_spawn EPERM when launching a sandboxed local QA host
On macOS 15.7.9 (24G830), arm64, using Xcode 16.4 (16F6), a locally built QA host fails to launch through LaunchServices using open -W. The recorded signature is ad hoc, with no TeamIdentifier; its only recorded effective entitlement is com.apple.security.app-sandbox=true. The historical launch returned -10810. Correlated logs report posix_spawn: Operation not permitted (errno 1). Host entry was not observed. A packaging revision embedded the same Info.plist in __TEXT,__info_plist. Recorded signature verification succeeded, but the next launch produced the same rejection. The responsible policy remains unidentified; these observations are not an independently validated minimal reproducer. What supported diagnostic procedure can identify the policy responsible for this rejection without disabling security protections or using an alternative launch route?
Replies
1
Boosts
0
Views
226
Activity
3w
Keeping every descendant of a sandboxed XPC service’s worker inside its lifetime (fork, double-fork, setsid)
Apple DTS case 22893354: forum post and reply Apple asked for the question as a Developer Forums post, then a reply to the case email with the post URL. Nothing below has been posted or sent. 1. Forum post Post at https://developer.apple.com/forums/ (signed in, "Ask a question"). Suggested tags: XPC, App Sandbox, Endpoint Security Attach: fixtures/egress_guard/hp04/apple-descendant-sample/main.c, renamed to main.txt if the forum refuses .c. Title Keeping every descendant of a sandboxed XPC service's worker inside its lifetime (fork, double-fork, setsid) Body We are designing a macOS app that runs an unmodified third-party command-line tool for one task at a time. The plan is an app-bundled, sandboxed XPC service that launches the tool as a child process. The tool is not ours, so we have to assume it may fork without exec, double-fork, and call setsid(). For each run we need one guarantee: after the run ends, every process the tool created has stopped. "Ends" includes the XPC service crashing and the host app crashing, not only a clean cancel. If we cannot prove that, we cannot report the run as finished. What we have looked at so far: Killing the process group. A child that calls setsid() is no longer in the group. launchd's process-group cleanup for the job. As we read launchd.plist(5), that also covers the process group only. Tracking pids from fork and exit notifications, including Endpoint Security. Notifications can be dropped, and pids can be reused, so a list rebuilt from events is not proof that nothing is left. The attached sample shows the process shape without any sandbox or XPC. It starts a worker, the worker double-forks, and the grandchild calls setsid() and keeps writing to a log after the original process has exited. On macOS 15.6.1 the descendant shows parent pid 1 and its own session, and it keeps writing until it finishes on its own: // worker: fork twice, let the intermediate processes exit if (fork() > 0) _exit(0); if (fork() > 0) _exit(0); setsid(); // leaves the original process group and session for (int i = 0; i < 8; i++) { // append "tick i pid ppid" to the log, ppid is now 1 usleep(200000); }Build with cc -Wall -Wextra -Werror -o DescendantOutlivesParent main.c and run ./DescendantOutlivesParent /tmp/descendant-log /tmp/descendant-ready. Questions: Is there a supported mechanism that ties every descendant of a process started by an XPC service, including ones that called setsid(), to the lifetime of that service, so that they are terminated when the service exits or crashes? If the service is sandboxed, does sandbox inheritance (children inherit the parent's sandbox) also give us a way to find or terminate those descendants, or does it only restrict what they can do? If neither, what does Apple recommend for running an untrusted command-line tool where leftover descendants must be ruled out? For example, is a separate launchd job per run, a different process-management API, or Endpoint Security authorization the intended route? Can that mechanism be combined with per-run file access (one input folder and one scratch folder per run), without giving the tool a shared container or network access? We would rather learn that a guarantee is not available than build on an assumption, so a "this is not supported" answer is also useful to us. 2. Reply to the DTS email Reply to Apple's case email (keep the subject) after the post is live: Case-ID: 22893354 Hello, Thank you. I posted the question on the Developer Forums here: <FORUM POST URL> The sample project is attached to the post. There is nothing private in it. Best regards, <NAME>
Replies
1
Boosts
0
Views
186
Activity
3w