As per issue for MythTV backend at:
http://svn.mythtv.org/trac/ticket/7582
when running MythTV backend on MacOS X 10.6.2, it crashes with:
BUG IN CLIENT OF LIBDISPATCH: Do not close random Unix descriptors
This message appears to come from Grand Central Dispatch.
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread: 1 Dispatch queue: com.apple.libdispatch-manager
Application Specific Information:
BUG IN CLIENT OF LIBDISPATCH: Do not close random Unix descriptors
Thread 1 Crashed: Dispatch queue: com.apple.libdispatch-manager
0 libSystem.B.dylib 0x9481ea51 _dispatch_mgr_invoke + 804
1 libSystem.B.dylib 0x9481dcc3 _dispatch_queue_invoke + 163
2 libSystem.B.dylib 0x9481da68 _dispatch_worker_thread2 + 234
3 libSystem.B.dylib 0x9481d4f1 _pthread_wqthread + 390
4 libSystem.B.dylib 0x9481d336 start_wqthread + 30
Since the code in MythTV for this is quite early in main(), can only imagine that linking in of Grand Central Dispatch libraries is automatically causing some background thread to run which monitors some special file descriptor. Problem is that MythTV backend is closing all file descriptors from 3 upwards and presumably is closing this special file descriptor as well.
The question is, is there any way to setup MacOS X to say not to use Grand Central Dispatch and use what ever was used under MacOS X 10.5 to try and avoid this issue until MythTV people can be bothered looking at it and making changes to code.
Separately, can anyone explain whether Grand Central Dispatch is using some special file descriptor as I reason.
The bug is in MythTV. The command-line argument parsing is apparently causing GCD to be started as a side-effect. The solution is simple. Move the "for ()" loop that closes all the descriptors to the very top of main().