Skip to content
Tcl Source Code History Of Ticket 2803109
Login

History Of Ticket 2803109

Artifacts Associated With Ticket 2803109

  1. Ticket change [de54ff7724] (rid 114825) by juliannoble on 2009-06-08 18:11:49:

    1. assignee initialized to: "andreas_kupries"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Tcl 8.6b1.1 on FreeBSD - (multi core system)
      
      Attempting to read back an empty string/empty list from a tsv  is causing the process to crash with:
      UpdateStringProc for type 'string' failed to create a valid string rep
      
      The initialisation is done with:
      tsv::set t_1 accounts_on_thread [list]
      
      Retrieving the value (in the same thread)  later  like so:
      set streams_on_thisthread [tsv::get t_1 accounts_on_thread]
      
      This assignment appears to work - but any subsequent attempt to use the value $streams_on_thisthread as a string causes the crash.
      (although 'string length' works and returns 0, but 'string bytelength' triggers the crash)
      Using the Tweezer package the type is reported as string and the refcount is 2.
      
      
      
      
      Initialising it the following way also results in the problem:
      tsv::set t_1 accounts_on_thread ""
      
      The following values however work without error:
      tsv::set t_1 accounts_on_thread " "
      tsv::set t_1 accounts_on_thread [lrange [list] 0 0]
      tsv::set t_1 accounts_on_thread [string range "" 0 -1]
      tsv::set t_1 accounts_on_thread [string range "" 0 0]
      
      
      I've been unable to reproduce the error in a simple script.
      (the real app has a handful of threads and is doing some sqlite work - the crash occurs around 30s in)
      
      (see also discussion on clt:  http://groups.google.com/group/comp.lang.tcl/browse_frm/thread/6fec903446cd87a4/4a8a163a0755856a#4a8a163a0755856a )
      
      
      
      
      
      
      
      
      
      
      
      
    4. foundin initialized to: "obsolete: 8.6b1.1"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "juliannoble"
    10. subsystem initialized to: "49. Threading"
    11. title initialized to: "tsv - string rep - core dump"
    12. type initialized to: "Bug"
  2. Ticket change [517f577616] (rid 126150) by andreas_kupries on 2009-06-09 01:38:42:

    1. icomment:
      Re-assigned to Zoran as the maintainer of the Thread extension.
      Which seems to be heavily involved.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  3. Ticket change [aac3293f20] (rid 100983) by andreas_kupries on 2009-06-09 01:38:43:

    1. assignee changed to: "vasiljevic"
  4. Ticket change [5200f49ca4] (rid 126234) by dgp on 2009-06-09 04:34:11:

    1. assignee changed to: "dgp"
    2. icomment:
      
      This appears to be flaw in the revised
      UpdateStringOfString.
      
      
    3. login: "dgp"
    4. mimetype: "text/plain"
    5. subsystem changed to: "10. Objects"
    6. username: "dgp"
  5. Ticket change [68bb666040] (rid 103116) by ferrieux on 2009-06-09 04:58:45:

    1. assignee changed to: "vasiljevic"
    2. icomment:
      OK I have a minimal repro, now that you have explained the mechanism on the chat:
      
       % package require Thread
       % set x ""
       % string length $x
       % tsv::set a b $x
       % puts [tsv::get a b]
       UpdateStringProc for type 'string' failed to create a valid string rep
      
      
      
    3. login: "ferrieux"
    4. mimetype: "text/plain"
    5. subsystem changed to: "49. Threading"
    6. username: "ferrieux"
  6. Ticket change [201e6c42e1] (rid 91260) by ferrieux on 2009-06-09 05:17:03:

    1. assignee changed to: "dgp"
    2. subsystem changed to: "10. Objects"
  7. Add attachment "2803109.patch" [68f033910e] (rid 103150) by dgp on 2009-06-09 11:23:00.

  8. Ticket change [0d44dc6888] (rid 114330) by dgp on 2009-06-09 11:23:00:

    1. icomment:
      
      
      File Added - 330268: 2803109.patch
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  9. Ticket change [c6f453ebc3] (rid 121859) by dgp on 2009-06-09 11:23:19:

    1. icomment:
      
      Please test the attached patch.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  10. Ticket change [ce80a86632] (rid 96071) by ferrieux on 2009-06-10 00:11:19:

    1. icomment:
      Fixes my minimal example. Incurs no regression in the test suite. Good :)
      
      (I assume this example ought to be turned into a test case, but I see no previous example of tests conditioned by the availability of an extension... so maybe it could wait until Thread is bundled ?)
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  11. Ticket change [35b97af8d8] (rid 106992) by andreas_kupries on 2009-06-10 00:16:48:

    1. icomment:
      Actually we have something like 'testthread' as test constraint. Look into the IO tests, for the reflected channels and transform. There I have basically two parallel test suites, for with and without threads.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  12. Ticket change [9afefcce09] (rid 111047) by ferrieux on 2009-06-10 00:23:07:

    1. icomment:
      Does the success of the testthread constraint (ie the presence of the testthread command IIRC) imply the presence of the Thread package in its full glory, including tsv::* ?
      
      Side question: would it make sense to have [package require Thread] either in the constraint code or in the test itself, doing nothing if absent ?
      
      
    2. login: "ferrieux"
    3. mimetype: "text/plain"
    4. username: "ferrieux"
  13. Ticket change [8284fa4fc8] (rid 117248) by andreas_kupries on 2009-06-10 00:27:49:

    1. icomment:
      Hm ... Actually, I do not remember.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  14. Ticket change [91d1142b41] (rid 120682) by dgp on 2009-06-10 00:37:41:

    1. icomment:
      
      The way to test this is with additions to
      the teststringobj command.
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  15. Ticket change [300468b50c] (rid 93174) by dgp on 2009-06-10 01:17:45:

    1. icomment:
      
      some more details on what was wrong, and
      how the patch deals with it...
      
      The "string" Tcl_ObjType failed to always
      handle the case of a "pure unicode" empty
      string.  In UpdateStringOfString() it failed
      to create a string rep, leading to the panic
      reported here.  In AppendUtfToUtf() it 
      leaped right into appending without checking
      that it had something in place to append to.
      
      Elsewhere in the implementation of the
      "string" Tcl_ObjType, these deficiencies
      were dealt with by trying to prevent the
      creation of "pure unicode" empty string
      values.  Everywhere such a value would
      normally be created, the usual empty
      string rep was added so that the value was
      no longer a "pure unicode" value.
      
      The problem with that approach is that
      the routine Tcl_InvalidateStringRep() is
      public, and so long as the stork model
      is respected, extensions are supposed to
      be free to create "pure intrep" values.
      That's what the Thread package was
      doing.
      
      What the patch does is first to fix up those
      parts of the "string" ObjType implementation
      that could not handle a "pure unicode" empty
      string value.  Then, since that value is no
      longer troublesome, other parts of the implementation
      that tried to prevent the creation of such a value
      have been removed.  So now the kind of 
      value that triggered the panic is much more
      routinely created with Tcl itself, with no need
      for an extension to do it.  This means that
      existing tests in the test suite already cover
      the new code when the patch is applied.
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  16. Ticket change [4dc993e8b4] (rid 127114) by dgp on 2009-06-10 21:44:56:

    1. closedate changed to: "2009-06-10T14:44:56"
    2. closer changed to: "dgp"
    3. icomment:
      
      
      allow_comments - 1
      
      fix committed.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"