[Interest] OS X Sandboxing and IPC (my experience so far)

Till Oliver Knoll till.oliver.knoll at gmail.com
Mon May 14 23:45:42 CEST 2012


Am 14.05.12 10:13, schrieb Thiago Macieira:
> On segunda-feira, 14 de maio de 2012 10.03.47, Till Oliver Knoll wrote:
>> However I noticed a warning message in the console output which
>> appears just after the listen() call above:
>>
>>    QSocketNotifier: Can only be used with threads started with QThread
>
> Run the sub-process with QT_FATAL_WARNINGS=1 and give us the backtrace of that
> warning.

Hmmm, not sure whether that is of any help (one doesn't see from which 
thread *my* process gets started - it would be nice to be able to 
compare the entire stack trace with when I start my process 
non-sandboxed), but anyway, here is the error message I get, see below.

My main() is in net.till-art.Airplay, which links against my own library 
libKernel, where initIPC() gets called which simply does a:

     QLocalServer::removeServer(QDir::homePath() + "/aircontrol-port");
     if (d->localServer.listen(QDir::homePath() + "/aircontrol-port")) {
         qDebug( "Listening on server name: %s full Server Name: %s",
                qPrintable(d->localServer.serverName()),
                qPrintable(d->localServer.fullServerName()));
     } else {
         qDebug("Listen failed, error: %s", 
qPrintable(d->localServer.errorString()));
     }

When I don't define

   export QT_FATAL_WARNINGS=1

then I get the warning, however listen() seems to succeed (I do get true 
as a result). If defining QT_FATAL_WARNINGS, I get the following error 
dialog, together with latest Qt 4.8.1 Cocoa binary distribution 
(downloaded via SDK Updater):

Process:         Airwave [3556]
Path:            /Users/USER/*/Airwave.app/Contents/MacOS/Airwave
Identifier:      net.till-art.Airplay
Version:         ??? (1.0)
Code Type:       X86-64 (Native)
Parent Process:  bash [1474]

Date/Time:       2012-05-14 23:29:10.477 +0200
OS Version:      Mac OS X 10.7.4 (11E53)
Report Version:  9

...

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000

Application Specific Information:
objc[3556]: garbage collection is OFF
abort() called

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	0x00007fff90679ce2 __pthread_kill + 10
1   libsystem_c.dylib             	0x00007fff8cf037d2 pthread_kill + 95
2   libsystem_c.dylib             	0x00007fff8cef4a7a abort + 143
3   QtCore                        	0x0000000101f1b8d5 
qt_message_output(QtMsgType, char const*) + 117
4   QtCore                        	0x0000000101f1bab7 
_ZL10qt_message9QtMsgTypePKcP13__va_list_tag + 183
5   QtCore                        	0x0000000101f1be3a qWarning(char 
const*, ...) + 170
6   QtCore                        	0x000000010205c69e 
QSocketNotifier::QSocketNotifier(int, QSocketNotifier::Type, QObject*) + 126
7   QtNetwork                     	0x0000000101125e38 
QLocalServerPrivate::listen(QString const&) + 472
8   QtNetwork                     	0x000000010111d56b 
QLocalServer::listen(QString const&) + 267
9   libKernel.1.0.0.dylib         	0x000000010000f379 AirPlay::initIPC() 
+ 621 (AirPlay.cpp:55)
10  net.till-art.Airplay          	0x00000001000031c9 
MainWindow::MainWindow(QWidget*) + 123 (MainWindow.cpp:17)
11  net.till-art.Airplay          	0x0000000100003203 
MainWindow::MainWindow(QWidget*) + 9 (MainWindow.cpp:18)
12  net.till-art.Airplay          	0x0000000100002f49 main + 55 
(qwidget.h:494)
13  net.till-art.Airplay          	0x0000000100002ef0 start + 52

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib        	0x00007fff9067a7e6 kevent + 10
1   libdispatch.dylib             	0x00007fff8e4d078a 
_dispatch_mgr_invoke + 923
2   libdispatch.dylib             	0x00007fff8e4cf31a 
_dispatch_mgr_thread + 54

Thread 2:
0   libsystem_kernel.dylib        	0x00007fff9067a192 __workq_kernreturn 
+ 10
1   libsystem_c.dylib             	0x00007fff8cf03594 _pthread_wqthread 
+ 758
2   libsystem_c.dylib             	0x00007fff8cf04b85 start_wqthread + 13

Thread 3:
0   libsystem_kernel.dylib        	0x00007fff9067a192 __workq_kernreturn 
+ 10
1   libsystem_c.dylib             	0x00007fff8cf03594 _pthread_wqthread 
+ 758
2   libsystem_c.dylib             	0x00007fff8cf04b85 start_wqthread + 13

Thread 4:
0   libsystem_kernel.dylib        	0x00007fff90679df2 __select + 10
1   QtCore                        	0x0000000100e196b0 
QProcessManager::run() + 96
2   QtCore                        	0x0000000100d315ba 
QThreadPrivate::start(void*) + 298
3   libsystem_c.dylib             	0x00007fff8cf018bf _pthread_start + 335
4   libsystem_c.dylib             	0x00007fff8cf04b75 thread_start + 13

Thread 5:: com.apple.CFSocket.private
0   libsystem_kernel.dylib        	0x00007fff90679df2 __select + 10
1   com.apple.CoreFoundation      	0x00007fff8c783c8b __CFSocketManager 
+ 1355
2   libsystem_c.dylib             	0x00007fff8cf018bf _pthread_start + 335
3   libsystem_c.dylib             	0x00007fff8cf04b75 thread_start + 13


Followed by all the "binary images" (linked libraries) and some system 
information like memory usage, hardware info and the like.



More information about the Interest mailing list