Notarytool crashes in Python running in an Apache Webserver

I have two Mac machines and running the same Python script as a CGI script in an Apache webserver (httpd) installed via Homebrew. The Python script calls the subprocess.run() method to call the notarytool via xcrun.

On one server the script runs as expected in the webserver environment and on the other machines it gets an exit code (-)4; SIGILL. On the machines where it fails, the notarytool command works from console, as expected. Additionally, it works if I run the script directly with Python in the console.

I launch the same command in a Perl script in the webserver and the same exit code / issue occured.

I have the same installed version and setup on both servers for

  • Homebrew
  • Apache Webserver (httpd)
  • Python version (3.9.6)
  • xcrun --version: xcrun version 61.
  • xcrun notarytool --version: 1.0.0 (27)
  • the Mac machines are identical, both are bought and set up at the same time

The see similar topics at:

notarytool should not crash. The crash reports you posted make it clear that this is the same crash as discussed in that other thread. Sadly, the developer in that thread didn’t post a bug number — I’m not even sure they filed a bug — so I can’t check on its status.

So, regardless of what else you do here, please file a bug against notarytool and post its bug number here.

As to what’s causing this crash, that’s not easy to explain. Consider:

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

As you’re on Intel, this suggests that the code trapped. And the crashing thread backtrace confirms that:

Thread 1 Crashed::  Dispatch queue: com.apple.NSURLSession-work
0   libxpc.dylib       … _xpc_api_misuse + 117
1   libxpc.dylib       … xpc_connection_set_target_uid + 188
2   AppSSOCore         … -[SOServiceConnection _connectToService] + 533
3   AppSSOCore         … -[SOServiceConnection initWithQueue:] + 102
4   AppSSOCore         … -[SOClient init] + 122
5   AppSSOCore         … -[SOConfigurationClient init] + 180
6   AppSSOCore         … __38+[SOConfigurationClient defaultClient]_block_invoke + 16
7   libdispatch.dylib  … _dispatch_client_callout + 8
8   libdispatch.dylib  … _dispatch_once_callout + 20
9   AppSSOCore         … +[SOConfigurationClient defaultClient] + 117
10  AppSSOCore         … +[SOAuthorizationCore _canPerformAuthorizationWithURL:responseCode:callerBundleIdentif…
11  AppSSOCore         … appSSO_willHandle + 64
12  CFNetwork          … 0x7ff81565f000 + 1997297
13  CFNetwork          … 0x7ff81565f000 + 1072750
14  CFNetwork          … 0x7ff81565f000 + 83777
15  CFNetwork          … 0x7ff81565f000 + 774468
16  CFNetwork          … 0x7ff81565f000 + 83536
17  CFNetwork          … 0x7ff81565f000 + 83182
18  CFNetwork          … 0x7ff81565f000 + 81639
19  CFNetwork          … 0x7ff81565f000 + 712960
20  libdispatch.dylib  … _dispatch_call_block_and_release + 12

It seems that:

  1. notarytool is using CFNetwork (frames 19 through 12).

  2. CFNetwork has decided go down the SSO path (frames 11 through 2).

  3. That’s trying to use XPC to talk a helper process.

  4. That’s triggering a trap.

This is clearly related to the context in which the code is running, but that doesn’t point to a clear reason why one machine fails and the other works.

ARe these machines managed, in the MDM sense?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Notarytool crashes in Python running in an Apache Webserver
 
 
Q