Skip to content
Tcl Source Code History Of Ticket 219391ffffffffff
Login

History Of Ticket 219391ffffffffff

Artifacts Associated With Ticket 219391ffffffffff

  1. Ticket change [0a2c7bfd21] (rid 113769) by nobody on 2000-10-26 05:12:15:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 6163 Bug
      Version: 8.3.1
      SubmitDate: '2000-08-23'
      LastModified: '2000-10-25'
      Severity: SER
      Status: UnAssn
      Submitter: techsupp
      OS: Windows NT
      OSVersion: NT 4
      Machine: Dell Pentium II
      FixedDate: '2000-10-25'
      ClosedDate: '2000-10-25'
      
      
      Name:
      
      Jiang Wu
      
      
      CVS:
      
      tclEvent.c,v 1.8 tclCkalloc.c,v 1.7
      
      
      Extensions:
      
      none
      
      
      CustomShell:
      
      none
      
      
      Comments:
      
      On Windows, if you type in "exit" on the shell, Tcl_Finalize() is
      
          called.  Then the dll is unloaded.  The dll exit handler also calls
      
          Tcl_Finalize().
      
      
          The patch for tclEvent.c moves the thread local storage access inside
      
          the "if (subsystemInitialized != 0) {", this way, a 2nd call to
      
          Tcl_Finalize() during exit will not try to access Tcl subsystem such as
      
          the debug memory allocation subsystem.
      
      
          The patch for tclCkalloc.c resets the static global "curTagPtr" to NULL
      
          after finalizing the memory subsystem.  This allows the memory subsystem
      
          to work again after finalization.
      
      
          Without the patches, a 2nd call to Tcl_Finalize() triggers an access to
      
          the thread local, which in turn triggers memory allocation in the Tcl
      
          memory subsystem after the 1st Tcl_Finalize().  Because the curTagPtr
      
          was not NULL'ed, Tcl memory allocation tries to use the already free'ed
      
          pointer "curTagPtr".  That caused the memory access violation on
      
          Windows.
      
      
      ReproducibleScript:
      
      1. Compile Tcl with DEBUGDEFINES = -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS on Windows NT.
      
      
      2. Run "tclsh8.3d.exe" and type in the following:
      
      
      memory tag foo
      
      exit
      
      
      ObservedBehavior:
      
      Upon exit, the tclsh83d.exe produces an memory violation dialog:
      
      
      The instruction at "0x1001dd9f" referenced memory at "0x0031c550".  The memory could not be "read".
      
      
      Click on OK to terminate the application
      
      
      DesiredBehavior:
      
      Program exits cleanly.
      
      
      Patch:
      
      *** tclEvent.c Wed Aug 23 14:12:40 2000
      
      --- tclEvent.c.fixed Wed Aug 23 14:08:50 2000
      
      ***************
      
      *** 744,752 ****
      
            ThreadSpecificData *tsdPtr;
      
      
            TclpInitLock();
      
      -     tsdPtr = TCL_TSD_INIT(&dataKey);
      
            if (subsystemsInitialized != 0) {
      
        subsystemsInitialized = 0;
      
      
        /*
      
         * Invoke exit handlers first.
      
      --- 744,753 ----
      
            ThreadSpecificData *tsdPtr;
      
      
            TclpInitLock();
      
            if (subsystemsInitialized != 0) {
      
        subsystemsInitialized = 0;
      
      + 
      
      +         tsdPtr = TCL_TSD_INIT(&dataKey);
      
      
        /*
      
         * Invoke exit handlers first.
      
      *** tclCkalloc.c Wed Aug 23 14:12:56 2000
      
      --- tclCkalloc.c.fixed Wed Aug 23 14:09:00 2000
      
      ***************
      
      *** 983,988 ****
      
      --- 983,989 ----
      
            }
      
            if (curTagPtr != NULL) {
      
        TclpFree((char *) curTagPtr);
      
      + curTagPtr = NULL;
      
            }
      
            allocHead = NULL;
      
            Tcl_MutexUnlock(ckallocMutexPtr);
      
      
      PatchFiles:
      
      tclEvent.c
      
          tclCkalloc.c
      
      
      
      
      
      
    4. foundin initialized to: "obsolete: 8.3.1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "memory access violation upon exit"
    11. type initialized to: "Bug"
  2. Ticket change [ebcd1f9293] (rid 103591) by dkf on 2000-11-15 22:00:21:

    1. priority changed to: "7 High"
  3. Ticket change [33dbd9d34d] (rid 106666) by dkf on 2001-01-31 18:06:21:

    1. icomment:
      (This fix really falls across a couple of functional areas, some of which are really not named very usefully.  What this is is an interaction between the memory allocator, finalization subsystem, and the Win32 platform support...)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. subsystem changed to: "02. Event Loops"
    5. username: "dkf"
  4. Ticket change [4142957b95] (rid 116157) by dgp on 2001-02-01 06:19:07:

    1. icomment:
      Registered patch as #103532
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  5. Ticket change [3f2c1d422a] (rid 121410) by hobbs on 2001-03-31 14:51:01:

    1. foundin changed to: "obsolete: 8.3.1"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      fixed in 8.4a2cvs.  This also fixed the problem in 8.4a2 
      where dynamically loading Tk in tclsh on Windows would 
      cause a memory error upon exiting.
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. resolution changed to: "None"
    6. subsystem changed to: "02. Event Loops"
    7. username: "hobbs"
  6. Ticket change [68a1db74a5] (rid 103101) by hobbs on 2001-04-03 13:32:10:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      forgot to mark this closed...
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
    6. username: "hobbs"
  7. Ticket change [902123f978] (rid 120393) by hobbs on 2001-04-03 13:32:11:

    1. closedate changed to: "2001-04-03T06:32:11"
    2. closer changed to: "hobbs"