Skip to content
Tcl Source Code History Of Ticket 1457797
Login

History Of Ticket 1457797

Artifacts Associated With Ticket 1457797

  1. Ticket change [c2a5bfd5ba] (rid 111518) by das on 2006-03-24 15:32:57:

    1. assignee initialized to: "hobbs"
    2. cmimetype initialized to: "text/plain"
    3. 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).
      
      
    4. foundin initialized to: "obsolete: 8.4.13"
    5. priority initialized to: "7 High"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "das"
    9. subsystem initialized to: "03. Timer Events"
    10. title initialized to: "io.test hangs in darwin threaded 64bit build"
    11. type initialized to: "Bug"
  2. Ticket change [5ad7a8054b] (rid 118215) by das on 2006-03-24 23:08:54:

    1. 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...
      
      
      
    2. login: "das"
    3. mimetype: "text/plain"
    4. username: "das"
  3. Ticket change [1b6352f975] (rid 123140) by das on 2006-08-21 08:39:09:

    1. assignee changed to: "das"
    2. closedate changed to: "2006-08-21T01:39:09"
    3. closer changed to: "das"
    4. 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(&notifierMutex);
       
           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
      
      
      
    5. login: "das"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
    9. username: "das"