Opened 12 years ago

Closed 11 years ago

#5358 closed defect (fixed)

Backend + HDHR not functional on Mac OS X Leopard

Reported by: Mike Riccio <mythtv at webdeck dot com> Owned by: Nigel
Priority: minor Milestone: unknown
Component: Ports - OSX Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

I tried running a mythtv 0.21 backend on Leopard 10.5.2 (Intel), configured to talk to an HDHR. This configuration works fine under Fedora 8, but I wanted to try to migrate it to my Mac which has more storage and a faster CPU to handle the comm flagging better.

The backend starts fine, and seems to be operating, but then dies as soon as it is time to start recording. The log contains many entries of the form:

The process has forked and you cannot use this CoreFoundation? functionality safely. You MUST exec(). Break on THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY_YOU_MUST_EXEC() to debug.

Please let me know what other information I can provide to assist.

Change History (8)

comment:1 Changed 12 years ago by Mike Riccio <mythtv at webdeck dot com>

Through some experimentation, I determined that these errors do not happen if you do not start the backend with the --daemon flag. The backend appears to be working now, after some preliminary testing.

comment:2 Changed 12 years ago by Nigel

I haven't done any 10.5 testing yet, but initial research indicates this is caused by 10.5 garbage collection, and a delay between the fork() and exec():

  1. http://developer.apple.com/technotes/tn2005/tn2083.html#SECCAREFULWITHTHATFORKEUGENE
  2. http://developer.apple.com/releasenotes/CoreFoundation/CoreFoundation.html
  3. http://www.nabble.com/Re:-Non-forking-randomness-td14102051.html

I'm assuming it is a bug in Mac OS X's daemon() call, but I do not have the motivation to track that down. I might just put a runtime call to check the OS rev or GC status.

comment:3 Changed 12 years ago by Nigel

Owner: changed from Isaac Richards to Nigel
Status: newassigned
Version: unknownhead

Did some 10.5 testing. mythbackend runs OK, but mythbackend -d crashes (with a very different core dump:

Thread 0 Crashed:
0   ...ple.CoreServices.CarbonCore      0x92d362a3 SCGetSessionLocalUniverseInfo + 21
1   ...ple.CoreServices.CarbonCore      0x92d35f89 _SCSessionUniverseByUIDAcquireAndLock + 83
2   ...ple.CoreServices.CarbonCore      0x92d35f10 FSNodeStorageGetAndLockCurrentUniverse + 212
3   ...ple.CoreServices.CarbonCore      0x92d37a79 FileIDTreeGetPathFromFileID + 24
4   ...ple.CoreServices.CarbonCore      0x92d378d5 POSIXMount::makepath(unsigned long, char const*, unsigned long, char*) + 185
5   ...ple.CoreServices.CarbonCore      0x92d377c6 POSIXMount::_getattrs(unsigned long, char const*, unsigned long, unsigned long, FSAttributeInfo*, unsigned long, unsigned char*) + 104
6   ...ple.CoreServices.CarbonCore      0x92d249e2 FSMount::getattrs(unsigned long, char const*, unsigned long, unsigned long, FSAttributeInfo*, unsigned long, unsigned char*) + 216
7   ...ple.CoreServices.CarbonCore      0x92d1eed4 PathGetObjectInfo(char const*, unsigned long, unsigned long, VolumeInfo**, unsigned long*, unsigned long*, char*, unsigned long*, unsigned char*) + 820
8   ...ple.CoreServices.CarbonCore      0x92d1eb35 FSPathMakeRefInternal(unsigned char const*, unsigned long, unsigned long, FSRef*, unsigned char*) + 97
9   ...ple.CoreServices.CarbonCore      0x92d2a6bb FSPathMakeRef + 47
10  libQtCore.4.dylib                   0x0149742a QFSFileEngine::fileFlags(QFlags<QAbstractFileEngine::FileFlag>) const + 698
11  libQtCore.4.dylib                   0x01456ef1 QFileInfoPrivate::getFileFlags(QFlags<QAbstractFileEngine::FileFlag>) const + 65
12  libQtCore.4.dylib                   0x0145725c QFileInfo::exists() const + 44
13  libQtCore.4.dylib                   0x014b9057 QCoreApplication::applicationFilePath() + 503
14  libQtCore.4.dylib                   0x014b96bd QCoreApplication::applicationDirPath() + 45

comment:4 Changed 12 years ago by Nigel

And on 10.4:

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_INVALID_ADDRESS (0x0001) at 0x00dbd000

Thread 0 Crashed:
0   ...ple.CoreServices.CarbonCore 	0x90c853a9 FileIDTree_GetAndLockSharedUniverse + 605
1   ...ple.CoreServices.CarbonCore 	0x90c85147 FileIDTree_GetAndLockClientSharedUniverse + 19
2   ...ple.CoreServices.CarbonCore 	0x90cae89a FileIDTreeGetPathFromFileID + 23
3   ...ple.CoreServices.CarbonCore 	0x90cae6c4 POSIXMount::makepath(unsigned long, char const*, unsigned long, char*) + 186
4   ...ple.CoreServices.CarbonCore 	0x90cae5ae POSIXMount::_getattrs(unsigned long, char const*, unsigned long, unsigned long, FSAttributeInfo*, unsigned long, unsigned char*) + 104
5   ...ple.CoreServices.CarbonCore 	0x90c8b5d4 FSMount::getattrs(unsigned long, char const*, unsigned long, unsigned long, FSAttributeInfo*, unsigned long, unsigned char*) + 220
6   ...ple.CoreServices.CarbonCore 	0x90c7f37c PathGetObjectInfo(char const*, unsigned long, unsigned long, VolumeInfo**, unsigned long*, unsigned long*, char*, unsigned long*, unsigned char*) + 876
7   ...ple.CoreServices.CarbonCore 	0x90c7efb3 FSPathMakeRefInternal(unsigned char const*, unsigned long, unsigned long, FSRef*, unsigned char*) + 81
8   ...ple.CoreServices.CarbonCore 	0x90c7eefb FSPathMakeRef + 47
9   libQtCore.4.dylib              	0x04a3e659 QFSFileEngine::fileFlags(QFlags<QAbstractFileEngine::FileFlag>) const + 821
10  libQtCore.4.dylib              	0x04a0c1de QFileInfoPrivate::getFileFlags(QFlags<QAbstractFileEngine::FileFlag>) const + 66
11  libQtCore.4.dylib              	0x04a0c542 QFileInfo::exists() const + 42
12  libQtCore.4.dylib              	0x04a59e86 QCoreApplication::applicationFilePath() + 78
13  libQtCore.4.dylib              	0x04a5a420 QCoreApplication::applicationDirPath() + 38
14  libmythdb-0.22.0.dylib         	0x03aa1662 InitializeMythDirs() + 186 (mythdirs.cpp:28)
15  libmyth-0.22.0.dylib           	0xc60463bc MythContextPrivate::MythContextPrivate[in-charge](MythContext*) + 482 (mythcontext.cpp:224)
16  libmyth-0.22.0.dylib           	0xc604658d MythContext::MythContext[in-charge](QString const&) + 215 (mythcontext.cpp:1245)
17  mythbackend                    	0x000362f2 main + 16092 (main.cpp:762)
18  mythbackend                    	0x000083a6 _start + 216
19  mythbackend                    	0x000082cd start + 41

I'm beginning to wonder if --daemon ever worked on OS X.

comment:5 in reply to:  4 Changed 12 years ago by ctreleaven@…

Replying to nigel:

And on 10.4:

Exception:  EXC_BAD_ACCESS (0x0001)
...
I'm beginning to wonder if --daemon ever worked on OS X.

I'm running .21-fixes on 10.4.11 (Intel). I've hacked up a launchd script that starts the backend with: /Applications/AudioVisualMusic/Myth/MythBackend?.app/Contents/MacOS/MythBackend -d -l /usr/local/wctlog/MythBackend.log -p /private/var/run/mythbackend.pid

Works for me!

Craig

comment:6 Changed 12 years ago by Nigel

(In [18519]) Work around obscure Mac bug - refs #5358

comment:7 Changed 11 years ago by Nigel

Component: mythtvPorts - OSX

comment:8 Changed 11 years ago by Nigel

Resolution: fixed
Status: assignedclosed

As far as I know, 0.22 will not exhibit this fault (I just tested with an older trunk rev - 21968:

MacBook-2% ./mythbackend -d                                                
MacBook-2% 2009-10-01 20:54:54.976 mythbackend version: trunk [20842:20856M] www.mythtv.org
2009-10-01 20:54:54.978 Using runtime prefix = /
2009-10-01 20:54:54.978 Using configuration directory = /Users/nigel/.mythtv
2009-10-01 20:54:54.979 Using localhost value of macaque.ind.tansu.com.au
2009-10-01 20:54:54.981 New DB connection, total: 1
2009-10-01 20:54:54.983 Connected to database 'mythconverg' at host: 127.0.0.1
2009-10-01 20:54:54.983 Closing DB connection named 'DBManager0'
2009-10-01 20:54:54.984 Connected to database 'mythconverg' at host: 127.0.0.1
2009-10-01 20:54:54.990 Current MythTV Schema Version (DBSchemaVer): 1244
2009-10-01 20:54:54.993 MythBackend: Starting up as the master server.
2009-10-01 20:54:54.997 New DB connection, total: 2
2009-10-01 20:54:54.998 Connected to database 'mythconverg' at host: 127.0.0.1
2009-10-01 20:54:55.053 New DB connection, total: 3
2009-10-01 20:54:55.055 Connected to database 'mythconverg' at host: 127.0.0.1
2009-10-01 20:54:55.147 New DB scheduler connection
2009-10-01 20:54:55.148 Connected to database 'mythconverg' at host: 127.0.0.1
2009-10-01 20:54:55.164 MediaServer:: Loopback address specified - 127.0.0.1. Disabling UPnP
2009-10-01 20:54:55.164 Main::Registering HttpStatus Extension
2009-10-01 20:54:55.165 Enabled verbose msgs:  important general
2009-10-01 20:54:55.173 AutoExpire: CalcParams(): Max required Free Space: 1.0 GB w/freq: 15 min
2009-10-01 20:54:58.154 Reschedule requested for id -1.
2009-10-01 20:54:58.214 Scheduled 0 items in 0.1 = 0.02 match + 0.04 place
2009-10-01 20:54:58.218 Seem to be woken up by USER
2009-10-01 20:55:21.665 MainServer::ANN Monitor
2009-10-01 20:55:21.665 adding: macaque.ind.tansu.com.au as a client (events: 0)
2009-10-01 20:55:21.665 MainServer::ANN Monitor
2009-10-01 20:55:21.665 adding: macaque.ind.tansu.com.au as a client (events: 1)
2009-10-01 20:55:24.230 MainServer::ANN Playback
2009-10-01 20:55:24.230 adding: macaque.ind.tansu.com.au as a client (events: 0)
2009-10-01 20:55:24.232 TVRec(1): Changing from None to Watching WatchingLiveTV
2009-10-01 20:55:24.239 TVRec(1): HW Tuner: 1->1
2009-10-01 20:55:24.265 New DB connection, total: 4
2009-10-01 20:55:24.267 Connected to database 'mythconverg' at host: 127.0.0.1
2009-10-01 20:55:24.419 AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 15 min
2009-10-01 20:55:25.119 Finished recording Unknown: channel 1009
2009-10-01 20:55:25.181 Finished recording Unknown: channel 1009
2009-10-01 20:55:25.208 AutoExpire: CalcParams(): Max required Free Space: 3.0 GB w/freq: 15 min
2009-10-01 20:55:41.978 TVRec(1): Changing from Watching WatchingLiveTV to None
2009-10-01 20:55:41.981 Unknown type, recording width was 720
2009-10-01 20:55:42.044 Finished recording Unknown: channel 1009
2009-10-01 20:56:15.167 AutoExpire: CalcParams(): Max required Free Space: 1.0 GB w/freq: 15 min
2009-10-01 20:56:15.171 Expiring 0 MBytes for 1009 @ Thu Oct 1 20:55:24 2009 => Unknown

MacBook-2% svn info .
Path: .
URL: svn+ssh://svn.mythtv.org/var/lib/svn/trunk/mythtv/programs/mythbackend
Repository Root: svn+ssh://svn.mythtv.org/var/lib/svn
Repository UUID: 7dbf422c-18fa-0310-86e9-fd20926502f2
Revision: 21968
Node Kind: directory
Schedule: normal
Last Changed Author: gigem
Last Changed Rev: 21926
Last Changed Date: 2009-09-18 10:30:33 +1000 (Fri, 18 Sep 2009)

MacBook-2% 2009-10-01 20:58:15.197 Expiring 11 MBytes for 1009 @ Thu Oct 1 20:55:25 2009 => Unknown
2009-10-01 20:59:15.738 Program #1057 not found in PAT!
Program Association Table
 PSIP tableID(0x0) length(33) extension(0x502)
      version(1) current(1) section(0) last_section(0)
         tsid: 1282
 programCount: 6
  program number     0 has PID 0x  10   data  0x 0 0x 0 0xe0 0x10
  program number  1312 has PID 0x 200   data  0x 5 0x20 0xe2 0x 0
  program number  1313 has PID 0x 210   data  0x 5 0x21 0xe2 0x10
  program number  1314 has PID 0x 220   data  0x 5 0x22 0xe2 0x20
  program number  1315 has PID 0x 230   data  0x 5 0x23 0xe2 0x30
  program number  1316 has PID 0x 240   data  0x 5 0x24 0xe2 0x40

2009-10-01 20:59:15.739 Program #1057 not found in PAT!
Program Association Table
 PSIP tableID(0x0) length(33) extension(0x502)
      version(1) current(1) section(0) last_section(0)
         tsid: 1282
 programCount: 6
  program number     0 has PID 0x  10   data  0x 0 0x 0 0xe0 0x10
  program number  1312 has PID 0x 200   data  0x 5 0x20 0xe2 0x 0
  program number  1313 has PID 0x 210   data  0x 5 0x21 0xe2 0x10
  program number  1314 has PID 0x 220   data  0x 5 0x22 0xe2 0x20
  program number  1315 has PID 0x 230   data  0x 5 0x23 0xe2 0x30
  program number  1316 has PID 0x 240   data  0x 5 0x24 0xe2 0x40

2009-10-01 20:59:16.208 ProcessPAT: Program not found in PAT. 
			Rescan your transports.
2009-10-01 20:59:16.208 Desired program #1057 not found in PAT.
			Can Not create single program PAT.
2009-10-01 20:59:16.209 ProcessPAT: Program not found in PAT. 
			Rescan your transports.
2009-10-01 20:59:16.209 Desired program #1057 not found in PAT.
			Can Not create single program PAT.

MacBook-2% 
MacBook-2% 
MacBook-2% killall mythbackend
Note: See TracTickets for help on using tickets.