Lately, we are experiencing intermittent segfault crashes related to NSRunningApplication: they happen mostly when _fetchDynamicProperties is about to send the _applyPropertyChanges:fromDictionary:. occasionally elsewhere. The problem seems to be related to a concurrent XPC communication (unproven, but probable — so far, it never crashed unless the application was at the same moment communicating through XPC).
It happens pretty randomly, alas. Only once I've been able to catch the problem in Xcode; looked like this (inside of _fetchDynamicProperties):
0x7fff2e655188 <+522>: callq 0x7fff2f1b5078 ; symbol stub for: CFRelease
0x7fff2e65518d <+527>: testq %r15, %r15
0x7fff2e655190 <+530>: je 0x7fff2e655206 ; <+648>
0x7fff2e655192 <+532>: xorl %eax, %eax
0x7fff2e655194 <+534>: cmpb $0x0, -0x93(%rbp)
0x7fff2e65519b <+541>: sete %al
0x7fff2e65519e <+544>: leaq 0x2(,%rax,4), %rcx
0x7fff2e6551a6 <+552>: shlq $0x2, %rax
0x7fff2e6551aa <+556>: cmpb $0x0, -0x98(%rbp)
0x7fff2e6551b1 <+563>: cmovneq %rcx, %rax
0x7fff2e6551b5 <+567>: leaq 0x40(%rax), %rcx
0x7fff2e6551b9 <+571>: cmpb $0x0, -0x92(%rbp)
0x7fff2e6551c0 <+578>: cmovneq %rax, %rcx
0x7fff2e6551c4 <+582>: movq %rcx, %rax
0x7fff2e6551c7 <+585>: orq $0x20, %rax
0x7fff2e6551cb <+589>: testb %bl, %bl
0x7fff2e6551cd <+591>: cmovneq %rcx, %rax
0x7fff2e6551d1 <+595>: movq %rax, %rdx
0x7fff2e6551d4 <+598>: orq $0x80, %rdx
0x7fff2e6551db <+605>: testb %r14b, %r14b
0x7fff2e6551de <+608>: cmovneq %rax, %rdx
0x7fff2e6551e2 <+612>: movq 0x5d60ab2f(%rip), %rsi ; "_applyPropertyChanges:fromDictionary:"
0x7fff2e6551e9 <+619>: movq %r13, %rdi
0x7fff2e6551ec <+622>: movq %r15, %rcx
0x7fff2e6551ef <+625>: callq *0x5d2f5eb3(%rip) ; (void *)0x00007fff5b7dd680: objc_msgSend
-> 0x7fff2e6551f5 <+631>: movq %r15, %rdi Thread 1: EXC_BAD_ACCESS (code=1, address=0x3eadddadca38)
0x7fff2e6551f8 <+634>: callq 0x7fff2f1b5078 ; symbol stub for: CFRelease
Some crashlogs (and longer copy of the above, which includes also a bt) at http://ocs.cz/CD/NSRunningApp_crash.zip
Is it possible that this is caused anyhow by our code? Based on the docst I believe NSRunningApplication should be thread-safe. Can you recommend a work-around? The problem is rather at the inconvenient side.
Thanks a lot,
OC