Artifacts Associated With Ticket 1457797
Ticket change [c2a5bfd5ba] (rid 111518) by das on 2006-03-24 15:32:57:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
On a dual proc G5 running Mac OS X Tiger, tcl configured with --enable-threads --enable-64bit hangs intermittently in various tests in io.test, but AFAICT only in those that involve [after]. The rest of the testsuite runs fine. examples of hanging tests are io-6.56, io-13.6, io-14.9 and io-53.7 (the most common). the problem goes away when configuring without --enable-threads 32bit builds on the same box are also ok, independently of the presence of --enable-threads and/or --disable-corefoundation (which is automatically on for 64bit).
- foundin initialized to: "obsolete: 8.4.13"
- priority initialized to: "7 High"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "das"
- subsystem initialized to: "03. Timer Events"
- title initialized to: "io.test hangs in darwin threaded 64bit build"
- type initialized to: "Bug"
Ticket change [5ad7a8054b] (rid 118215) by das on 2006-03-24 23:08:54:
- icomment:
Logged In: YES user_id=90580 the same issue appears to exists on HEAD, where I've seen tests io-39.17 and io-53.7 hang intermittently, again with the latter being the most common. non-threaded and 32bit HEAD builds are again fine...
- login: "das"
- mimetype: "text/plain"
- username: "das"
- icomment:
Ticket change [1b6352f975] (rid 123140) by das on 2006-08-21 08:39:09:
- assignee changed to: "das"
- closedate changed to: "2006-08-21T01:39:09"
- closer changed to: "das"
- icomment:
Logged In: YES user_id=90580 It seems that this is due to an OS bug in pthread_cond_timedwait(): when giving it an expiry time that has already passed (or maybe is only a very short time in the future), it waits forever instead of returning immediately like in 32-bit mode (and like on other platforms). This causes intermittent hangs in [vwait] when using the unix notifier which is default with 64-bit (it does not affect the CF notifier and I cannot reproduce it on the same machine in a 32-bit build with the unix notifier i.e. configured - without-corefoundation). I have now worked around the issue by not passing very small timeouts to Tcl_ConditionWait() and doing a poll instead in those cases. The current 10 usec threshold in the code for the expiry time has been empirically determined on a dual G5, it seems to avoid all hangs in the testsuite on that machine, but it would be useful if others with 64-bit capable machines could check that this works for them as well (just try running io.test many times, varying the load on the machine seems to make a difference as well). In particular, I don't know if this problem even exists on x86_64, but to be safe I've turned on the workaround for apple LP64 in general: Index: unix/tclUnixNotfy.c =============================================== ==================== RCS file: /cvsroot/tcl/tcl/unix/tclUnixNotfy.c,v retrieving revision 1.31 diff -u -p -r1.31 tclUnixNotfy.c --- unix/tclUnixNotfy.c10 Aug 2006 12:15:32 -00001.31 +++ unix/tclUnixNotfy.c20 Aug 2006 22:13:15 -0000 @@ -740,7 +740,17 @@ Tcl_WaitForEvent( Tcl_MutexLock(¬ifierMutex); waitForFiles = (tsdPtr->numFdBits > 0); - if (myTimePtr != NULL && myTimePtr->sec == 0 && myTimePtr->usec == 0) { + if (myTimePtr != NULL && myTimePtr->sec == 0 && (myTimePtr->usec == 0 +#if defined(__APPLE__) && defined(__LP64__) + /* + * On 64-bit Darwin, pthread_cond_timedwait() appears to have a bug + * that causes it to wait forever when passed an absolute time which + * has already been exceeded by the system time; as a workaround, + * when given a very brief timeout, just do a poll. [Bug 1457797] + */ + || myTimePtr->usec < 10 +#endif + )) { /* * Cannot emulate a polling select with a polling condition variable. * Instead, pretend to wait for files and tell the notifier thread - login: "das"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "das"