Skip to content
Tcl Source Code History Of Ticket 859820ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 859820ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 859820ffffffffffffffffffffffffffffffffff

  1. Ticket change [3dc0931692] (rid 121146) by yahalom on 2003-12-14 12:54:25:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      tcl8.4.4
      thread 2.5.2
      win200
      
      when I open a pipe to an exe and another thread closes 
      a pipe to that exe tcl crashes.
      it does not happen all the time. it seems that this 
      actions need to happen at the same time exactly.
      I made locking around the open and close points and it 
      works fine.
      is the open/close pipe not thread safe?
      visual studio says:
      Application popup: tclsh84t.exe - Application Error : The 
      instruction at "0x100682fc" referenced memory 
      at "0x00000009". The memory could not be "read".
      
      unhandled exception in tclsh84t.exe (tcl84t.dll) 
      0xC0000005: Access Violation
      100682E6   call        1006BC20
      100682EB   mov         esi,dword ptr ds:[100896D4h]
      100682F1   add         esp,4
      100682F4   test        esi,esi
      100682F6   je          10068307
      100682F8   mov         eax,dword ptr [esp+8]
      
      ->100682FC   cmp         dword ptr [esi],eax
      100682FE   je          10068319
      10068300   mov         esi,dword ptr [esi+8]
      10068303   test        esi,esi
      10068305   jne         100682FC
      10068307   push        100896CCh
      1006830C   call        1006BC70
      10068311   add         esp,4
      10068314   or          eax,0FFFFFFFFh
      10068317   pop         esi
      10068318   ret
      10068319   push        100896CCh
      1006831E   call        1006BC70
      10068323   mov         eax,dword ptr [esi+4]
      10068326   add         esp,4
      10068329   pop         esi
      
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "yahalom"
    9. subsystem initialized to: "None"
    10. title initialized to: "tclsh84t crashes when opening pipe"
    11. type initialized to: "Bug"
  2. Ticket change [a54256acb8] (rid 110343) by dkf on 2003-12-15 16:45:44:

    1. foundin changed to: "obsolete: 8.4.4"
    2. subsystem changed to: "27. Channel Types"
  3. Ticket change [45bba80234] (rid 99398) by dkf on 2003-12-15 16:47:07:

    1. assignee changed to: "andreas_kupries"
  4. Ticket change [4e3e3beda5] (rid 127191) by dkf on 2003-12-15 16:47:29:

    1. priority changed to: "8"
  5. Ticket change [8d5d543e8a] (rid 127915) by davygrvy on 2004-01-15 16:01:23:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      > is the open/close pipe not thread safe?
      
      Are you using thread::transfer?  pipe channels do not support 
      cut/splice operations yet.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  6. Ticket change [7e00b61a6f] (rid 97331) by davygrvy on 2004-01-15 16:25:58:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      If so, a patch can be found here:
      https://sourceforge.net/tracker/index.php?
      func=detail&aid=875701&group_id=10894&atid=310894
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  7. Ticket change [ef46871acf] (rid 108965) by yahalom on 2004-01-18 14:11:31:

    1. icomment:
      Logged In: YES 
      user_id=130120
      
      I do not use thread::transfer in my app.
      two different threads are opening/closing a pipe to the same 
      program. there should be no problem with this but there is a 
      crash.
      
      
    2. login: "yahalom"
    3. mimetype: "text/plain"
    4. username: "yahalom"
  8. Ticket change [1d21392523] (rid 90744) by davygrvy on 2004-01-18 15:34:46:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      Could you build for symbols and reproduce it?  The position of 
      the crash with a symbols build can get us to where that is in 
      the code itself.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  9. Ticket change [fb9615d5a1] (rid 92090) by yahalom on 2004-01-18 20:42:12:

    1. icomment:
      Logged In: YES 
      user_id=130120
      
      with symbols I get the exception in tclWinPipe.c
      line : if (infoPtr->hProcess == (HANDLE) pid) {
      
      the code:
      unsigned long
      TclpGetPid(
          Tcl_Pid pid)/* The HANDLE of the child 
      process. */
      {
          ProcInfo *infoPtr;
      
          Tcl_MutexLock(&pipeMutex);
          for (infoPtr = procList; infoPtr != NULL; infoPtr = infoPtr-
      >nextPtr) {
      if (infoPtr->hProcess == (HANDLE) pid) {
          Tcl_MutexUnlock(&pipeMutex);
          return infoPtr->dwProcessId;
      }
          }
          Tcl_MutexUnlock(&pipeMutex);
          return (unsigned long) -1;
      }
      
      is there more info needed.
      
      
    2. login: "yahalom"
    3. mimetype: "text/plain"
    4. username: "yahalom"
  10. Ticket change [5a6c4e861c] (rid 118141) by davygrvy on 2004-01-19 03:42:13:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      infoPtr is in some sort of uninitialized state.  It looks like the 
      problem might be in Tcl_WaitPid at the end of the function.  
      During the mutex protected search, prevPtrPtr was valid at 
      that moment in time.  But after the wait to get the exit code, 
      is it still valid?  I don't think so.
      
      What we could do is splice this ProcInfo off prior to the wait 
      and during the list lock, then reinsert for when the wait 
      timedout.
      
      yahalom, could you attach a script that reproduces this if 
      possible.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  11. Ticket change [16e2c3140f] (rid 124788) by davygrvy on 2004-01-19 04:19:16:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      This might work:
      
      diff -c -r1.39 tclWinPipe.c
      *** tclWinPipe.c24 Dec 2003 04:18:23 -00001.39
      --- tclWinPipe.c18 Jan 2004 21:17:24 -0000
      ***************
      *** 2485,2491 ****
            int *statPtr,
            int options)
        {
      !     ProcInfo *infoPtr, **prevPtrPtr;
            DWORD flags;
            Tcl_Pid result;
            DWORD ret, exitCode;
      --- 2485,2491 ----
            int *statPtr,
            int options)
        {
      !     ProcInfo *infoPtr = NULL, **nextPtrPtr;
            DWORD flags;
            Tcl_Pid result;
            DWORD ret, exitCode;
      ***************
      *** 2506,2515 ****
             */
        
            Tcl_MutexLock(&pipeMutex);
      !     prevPtrPtr = &procList;
      !     for (infoPtr = procList; infoPtr != NULL;
      !     prevPtrPtr = &infoPtr->nextPtr, infoPtr = infoPtr-
      >nextPtr) {
      !  if (infoPtr->hProcess == (HANDLE) pid) {
            break;
        }
            }
      --- 2506,2516 ----
             */
        
            Tcl_MutexLock(&pipeMutex);
      !     for (nextPtrPtr = &procList; (*nextPtrPtr) != NULL;
      !     nextPtrPtr = &((*nextPtrPtr)->nextPtr)) {
      ! if (((*nextPtrPtr)->nextPtr)->hProcess == (HANDLE) 
      pid) {
      !     infoPtr = (*nextPtrPtr)->nextPtr;
      !     *nextPtrPtr = infoPtr->nextPtr;
            break;
        }
            }
      ***************
      *** 2539,2544 ****
      --- 2540,2552 ----
            if (ret == WAIT_TIMEOUT) {
        *statPtr = 0;
        if (options & WNOHANG) {
      +     /*
      +      * Reinsert this ProcInfo* back on the linkedlist.
      +      */
      +     Tcl_MutexLock(&pipeMutex);
      +     infoPtr->nextPtr = procList;
      +     procList = infoPtr;
      +     Tcl_MutexUnlock(&pipeMutex);
            return 0;
        } else {
            result = 0;
      ***************
      *** 2605,2611 ****
             */
        
            CloseHandle(infoPtr->hProcess);
      -     *prevPtrPtr = infoPtr->nextPtr;
            ckfree((char*)infoPtr);
        
            return result;
      --- 2613,2618 ----
      
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  12. Ticket change [edabbb3608] (rid 103929) by davygrvy on 2004-01-19 05:52:24:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      ack.. bad code..  I'll fix and repost.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  13. Add attachment "tclWinPipe.c" [a00749fb08] (rid 96734) by davygrvy on 2004-01-19 07:44:10.

  14. Ticket change [f13e84d5b9] (rid 109335) by davygrvy on 2004-01-19 07:44:10:

    1. icomment:
      
      
      File Added - 73932: tclWinPipe.c
      
      Logged In: YES 
      user_id=7549
      
      Try this.  Get the attachment and rebuild.  I'd post a diff, but 
      CVS is down today for maintenance.  This should avoid the 
      pointer going stale.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  15. Ticket change [12a01f5817] (rid 124068) by davygrvy on 2004-01-20 12:20:21:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      Committed patch to HEAD.  Please do a CVS update to test 
      the fix.  All tests pass as before.  It looks right, to me.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  16. Ticket change [17dd419d5b] (rid 122568) by yahalom on 2004-01-20 12:32:16:

    1. icomment:
      Logged In: YES 
      user_id=130120
      
      I do not see that tclWinPipe was changed in the cvs. how do 
      I get it in order to test it.
      
      
      
    2. login: "yahalom"
    3. mimetype: "text/plain"
    4. username: "yahalom"
  17. Ticket change [5fe80948f4] (rid 115899) by davygrvy on 2004-01-20 12:39:24:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      anon access might be running a day behind.  It's the same as 
      the attachment here.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  18. Ticket change [a4c062f85e] (rid 110257) by davygrvy on 2004-01-20 12:40:54:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      r1.40 has the fix.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  19. Ticket change [118448fcec] (rid 95157) by yahalom on 2004-01-21 14:48:47:

    1. icomment:
      Logged In: YES 
      user_id=130120
      
      tested the fix and there is no crash. it seems the bug was 
      fixed. thanks for the great work.
      do you know when tcl8.5 will be out?
      is it safe to take only tclWinPipe.c and compile it with tcl8.4?
      
      
      
    2. login: "yahalom"
    3. mimetype: "text/plain"
    4. username: "yahalom"
  20. Add attachment "patch.txt" [29fb701a96] (rid 118478) by davygrvy on 2004-01-21 16:18:32.

  21. Ticket change [153e13c953] (rid 124539) by davygrvy on 2004-01-21 16:18:32:

    1. assignee changed to: "davygrvy"
    2. icomment:
      
      
      File Added - 74247: patch.txt
      
      Logged In: YES 
      user_id=7549
      
      attached patch.  Just apply this patch to the 8.4 source, it's 
      the safest way to go.
      
      c:\tcl_src\win\> patch -c -i patch.txt
      
      
    3. login: "davygrvy"
    4. mimetype: "text/plain"
    5. username: "davygrvy"
  22. Ticket change [136de91f6e] (rid 124216) by davygrvy on 2004-01-21 16:19:08:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      Good to know this worked-out.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. username: "davygrvy"
  23. Ticket change [801c6e5922] (rid 97678) by davygrvy on 2004-01-21 16:19:21:

    1. closedate changed to: "2004-01-21T09:19:21"
    2. closer changed to: "davygrvy"
    3. status changed to: "Closed"