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

History Of Ticket 218508ffffffffff

Artifacts Associated With Ticket 218508ffffffffff

  1. Ticket change [b6f59059f8] (rid 125506) by nobody on 2000-10-26 01:01:27:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 765 Bug
      Version: 8.1a2
      SubmitDate: '1998-10-27'
      LastModified: '1998-12-08'
      Severity: SER
      Status: Released
      Submitter: pat
      ChangedBy: stanton
      RelatedBugIDs: 764
      OS: All
      OSVersion: NA
      Machine: NA
      FixedDate: '1998-12-08'
      FixedInVersion: 8.1b1
      ClosedDate: '2000-10-25'
      
      
      Subject: Hash table corruption when rebuildLiteralTable  occurs (invoked from TclRegisterLiteral) during compilation
      From: [email protected]
      
      TclTk Bug Report Form filled out by:  [email protected]
      
      Name:  Adam Grove
      BugOrRFE:  Bug
      Product:  Tcl
      Version:  8.1a2
      OperatingSystem:  WinNT
      OperatingSystemVersion:  4.0
      Extensions:  none
      CustomShell:  None; but compiled with the multithreading options. 
      Synopsis:  Hash table corruption when rebuildLiteralTable  occurs (invoked from TclRegisterLiteral) during compilation
      
      ReproducibleScript:
      Not really possible. This is a very time/situation dependent bug which I have
      not been able to reduce to a small test.  
      
      ObservedBehavior:
      The observed behaviour was:
          tcl_deleteinterp sometimes would not return.
      Investigation revealed that an object was placed in the wrong
      bucket of the global literal table (in file tclLiteral.c). By wrong, I mean that
      the hash value of the object did not correspond tothe bucket in which
      the object appears. When this happens, the object is not successfully
      deleted and so the attempt to purge the literal table loops forever. 
      This explains why tcl_deleteinterp fails. 
      
       It turns out that the object was placed in the wrong bucket earlier, at a time
      when the hash table was rebuild (because it needed to grow in size) by
      function rebuildLiteralTable.
      This request to rebuild is called from TclRegisterLiteral.
      
      The object was inserted wrongly because, at the time of the rebuild,
      it had a null character inserted in the middle. Thus the computed
      hash value was inaccurate.
      
      The object had a null character inserted because it seems that
      routines in tclCompile.c do this at times to strings they compile.
      (I do not understand these routines very well)
      That is, these routines sometime temporarily insert nulls (saving
      the overwritten character) so that they can only look at some
      substring without the overhead of copying.  
      
      However, if a call to TclRegisterLiteral is made while this temporary
      substitution is in effect, and if this call trigges a rebuild request,
      the original object will not be hashed correctly.
      
      So, in summary,  this problem arises if the global literal table
      reaches a critical size (to trigger a rebuild) at certain points in the
      compilation process. The effects of this error (an inconsistent
      hash table, which is not, however, caught by the debugging
      checks in TclLiteral.c) cause unpredictable behaviour later, but
      for me they manifested in the failure of tcl_deleteinterp.
      
      rebuilds must occur only when all objects are in a "good" state,
      and not temporarily modified by other procedures.
      
      DesiredBehavior:
      Obviously, this is a serious bug when it strikes, and it would be nice
      to have it fixed. 
      
      I do now know Tcl or the Tcl source at all well, so it seems plausible
      to me that a similar type of error might arise for the various other
      hash tables that Tcl seems to uses internally. 
      
      Patch:
      For my own internal use, I've made a separate call
       TclRegisterLiteral_noRebuild(...) which is just like
      TclRegisterLiteral but a rebuild is not triggered even if the size limit
      is exceeded. (This seems harmless...there's surely nothing
      magic about reaching this limit and the rebuild can be deferred so long
      as we eventually get a chance to rebuild). 
       I've tried to guess at which calles in tclCompile.c should be replaced
      with this new call. This has worked for me (so far) but I really don't
      understand the code at all well, so have no confidence that I have
      really fixed this correctly and efficiently. 
      
      
      
      This is related to bug 764. (pat 10/27/98)
      
      This bug has been fixed by avoiding dangerous calls while the string is modified.
      
      
      
    4. foundin initialized to: "obsolete: 8.1a2"
    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:
      Hash table corruption when rebuildLiteralTable  occurs (invo
      
    11. type initialized to: "Bug"
  2. Ticket change [aba5b7b39b] (rid 101151) by welch on 2000-10-26 08:23:18:

    1. closedate changed to: "2000-10-26T01:23:18"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [d5b541d565] (rid 123672) by dgp on 2001-04-17 04:21:06:

    1. closedate changed to: "2001-04-16T21:21:06"
    2. closer changed to: "dgp"
    3. subsystem changed to: "47. Bytecode Compiler"