We put DTS ticket and issue with provision profile was resolved
Post
Replies
Boosts
Views
Activity
@eskimo yep. Info and Debug options are enabled in Action.
We dug deeper and found that #include <os/log.h> in our Driver is DriverKit/usr/include/os/log.h not macOS's MacOSX.sdk/usr/include/os/log.h.
So DriverKit's version has very limited API and declares following macro:
#define os_log(log, format, ...) __extension__({ \
os_log_t _log_tmp = (log); \
os_log_type_t _type_tmp = OS_LOG_TYPE_DEFAULT; \
if (os_log_type_enabled(_log_tmp, _type_tmp)) { \
OS_LOG_CALL_WITH_FORMAT(_os_log_impl, \
(&__dso_handle, _log_tmp, _type_tmp), format, ##__VA_ARGS__); \
} \
})
We created a new macro w/o check if (os_log_type_enabled(_log_tmp, _type_tmp)) and now see our logs in Console for kernel process.
So it looks like OS_LOG_TYPE_DEFAULT is not enabled. What should we do to enable it?
@Drewbadour thank you for quick reply and help!
Does the provisioning profile for your dext contain this entitlement?
Yes. I see in provision profile:
<key>com.apple.developer.driverkit.allow-any-userclient-access</key>
<true/>
Your driver contains no implementation of ::NewUserClient. This means that it can't accept the UserClient connection. Please make sure to read the documentation around the sample app, implement ::NewUserClient, and ensure that your dext's Info.plist has been appropriately set-up to accept UserClient connections.
I'm definitely sure that we tried to add virtual kern_return_t NewUserClient(uint32_t type, IOUserClient** userClient) override; into our Driver. So we added this method and implementation into our Driver and now we see different error - (iokit/common) not permitted. This gave me an idea that Driver is not re-installed/updated sometimes. So we added code to make deactivation request and it looks like now we always have new driver version.
Next after reboot and "uninstall first" approach we tested CommunicatingBetweenADriverKitExtensionAndAClientApp again. We can connect to NullDriver and call methods and callback. Unfortunately, we could not connect to NullDriver using our macOS based client and we had same (iokit/common) not permitted. But we can if we set sandbox to false. Next we found temporary exception for iokit:
<key>com.apple.security.temporary-exception.iokit-user-client-class</key>
<array>
<string>IOUserUserClient</string>
</array>
and now we can connect to NullDriver and our Driver by sand-boxed macOS App. It looks like our issue is solved!
Outstanding question how to make sure that new version of driver is installed and run? Should we increase build version for each driver re-install and check what's active by systemextensionsctl list?
@Drewbadour I added com.apple.developer.driverkit.allow-any-userclient-access into my driver's entitlements and driver is no longer discoverable after re-install. I mean it no longer appears as process, I can't see it in ioreg and can't find a match via IOServiceGetMatchingServices.
In Console App I see:
taskgated-helper myDriver: Unsatisfied entitlements: com.apple.developer.driverkit.allow-any-userclient-access
amfid /Library/SystemExtensions/B7624EEF-3688-4735-A58B-26FEF4DE353C/myDriver.dext/myDriver signature not valid: -67671
I can discover driver if I remove this entitlement but I stuck on IOServiceOpen with kIOReturnError(iokit_common_err(0x2bc) // general error) error.
My setup:
macOS 12.4
Xcode Version 13.4
@prakhg
It's actual for macOS Monterey only. For Big Sur this issue is not exists.
I don’t know. I had a cursory look at this last week and couldn’t find anything that’d be obviously helpful. The next step is to open a > DTS tech support incident and see if our tool specialist can help you out.
Not sure If I want to submit DTS since I have only one ticket left. Will it be credited back for this report?
As the temporary measure I'm no longer keeping .xcresult bundle, but processing it with https://github.com/XCTestHTMLReport/XCTestHTMLReport into an HTML file.
Good choice.
Our workaround: save critical data outside .xcresult and delete .xcresult if it greater than 10MB
@Quinn, thank you for reply.
I tried sudo log erase but it decreases a size of xcresult on about 20%. XCResult still has a ton of system logs attached.
Unfortunately, I haven't found options where to disable logs in test plan or test target. Also xcodebuild -help doesn't have options to disable log.
I see following in diagnostic logs:
13:18:54.350 xcodebuild[1380:26502] Initiating control session with IDE capabilities: <XCTCapabilities: 0x7fa80b480e70>: {
}
13:18:54.351 xcodebuild[1380:26502] XPC connection for control was invalidated.
13:18:54.363 xcodebuild[1380:26502] Got reply to control session initiation request (result:error): <XCTCapabilities: 0x7fa80b2ad320>: {
"authorize test session capability" = 1;
"initiate daemon control session capability" = 4;
"initiate test runner session capability" = 2;
"report crashes capability" = 1;
"request log archive capability" = 1;
"request spindump capability" = 2;
}: (null)
I tried to dig what's XCTCapabilities but didn't find enough info. Looks like it's some private API. I wonder is any way to configure these capabilities. request log archive capability looks very promising.
Opened Feedback Assistance - FB9835135
Still happens on Monterey 12.1 and Xcode 13.2
We got same issue. As a workaround we successfully submitted our App to AppStore with Xcode 13.1
Same for macOs App built on SwiftUI. Started to happen after update to macOS 12.1 and Xcode 13.2
I opened TSI for the issue and got reply from Apple DTS Engineer that resolves my issue:
The automationmodetool command line tool allows you to manage UI automation security preferences, see its man page for details. To resolve your issue, run the following command as a administrator on your machine:
automationmodetool enable-automationmode-without-authentication
To disable this mode, run the following command as a administrator on your machine:
automationmodetool disable-automationmode-without-authentication
Note that the man page shows leading dash in front of each of the above two commands, it is a bug. Please disregard it and use the commands as described above.
Hello Nathan,
Thank you for investigation and response. I'm glad that my report helped to detect the issue. We as a first adopters of SwiftUI are really inspired to make it better and help to overcome young diseases.
Good news that macOS Monterey (12.0) doesn't have this issue. We will update our development and CI instances to Monterey when it is officially released. Unfortunately, we don't want to increase minimum requirements for our customers so we are definitely interested in a workaround. I tried that you suggested for var body: some View of PickerWithBindingView but still have memory leaks.
My steps:
Deleted all the .containerAccessibility from MainView.swift
Added in PickerWithBindingView.swift:
VStack {
..... previous body
}
.accessibilityElement(children: .contain)
.accessibilityIdentifier("picker-with-binding-view")
I pushed it to separate branch: https://github.com/yuri-qualtie/MemoryLeaks/tree/try-workaround
Could you please try? Maybe I misunderstood your suggestion for workaround.
Thanks,
Yuri-
Nathan, if it helps I opened
Feedback Assistant: FB9584439
TSI Case ID: 779392495
I tried to create an empty project and paste your code. Live preview for alert works now but it doesn't work for my project. I will investigate what's different between projects. Anyway, thank you for help @workingdogintokyo