Skip to content
Tcl Source Code History Of Ticket ae09f6b190ceec31
Login

History Of Ticket ae09f6b190ceec31

Artifacts Associated With Ticket ae09f6b190ceec31

  1. Ticket change [cd4fbfb60a] (rid 228603) by pointsman on 2024-07-14 01:04:34:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      The commit https://core.tcl-lang.org/tcl/info/bacfccf1e2cbab78
      introduced a memory leak. While I understand the reasoning for
      [bacfccf1e2cbab78] I so far not understand why it had this unfortunate
      "side-effect".
      
      The builds I use for this are all made with -DPURIFY.
      
      I'll append the output of a "make valgrind" run with
      [95f9e8176ed0b552] - the parent commit of bacfccf1e2cbab78 - and the
      output of the same with current trunk as of writing ([08603ee649]).
      The output of "make valgrind" with [bacfccf1e2cbab78] looks similar to
      the one of [08603ee649] (current trunk).
      
      For a short verification you don't need the whole time consuming run
      of the test suite under valgrind. With [bacfccf1e2cbab78] and under
      linux 
      
      make valgrind TESTFLAGS='-file load.test'
      
      it returns (amongst more details)
      
          definitely lost: 80 bytes in 5 blocks
          indirectly lost: 176 bytes in 11 blocks
            possibly lost: 0 bytes in 0 blocks
          still reachable: 0 bytes in 0 blocks
               suppressed: 0 bytes in 0 blocks
      
      With [95f9e8176ed0b552] - the parent commit of bacfccf1e2cbab78 - and
      the same
      
      make valgrind TESTFLAGS='-file load.test'
      
      it returns
      
          HEAP SUMMARY:
              in use at exit: 0 bytes in 0 blocks
            total heap usage: 383,994 allocs, 383,994 frees, 43,997,079 bytes allocated
          
          All heap blocks were freed -- no leaks are possible
      
      This can easily be "exploited" by a script. Any Tcl 9 binary extension
      will do it (I'd suppose). In the example below I used tdom
      de5237af97f2c1c (trunk at the moment of writing this). Run (your moral
      equivalent) of
      
      load ./libtcl9tdom0.9.4.so
      while 1 {
          interp create childinterp
          load {} Tdom childinterp
          interp delete childinterp
      }
      
      with a [bacfccf1e2cbab78] tclsh and watch the process somewhat slowly
      but steady growing. If I run that script with a tclsh with the parent
      commit to that the process doesn't shows this. (At least with mem
      builds.) Neither do I see the problem with 8.6
      
    5. foundin initialized to: "Tcl 9"
    6. is_private initialized to: "0"
    7. login: "pointsman"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "pointsman"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to: "Mem leak in trunk"
    16. type initialized to: "Bug"
  2. Add attachment "valgrind-95f9e8176e.out" [691d598136] (rid 228605) by pointsman on 2024-07-14 01:05:39.

  3. Add attachment "valgrind-08603ee649.out" [40ac42308f] (rid 228607) by pointsman on 2024-07-14 01:06:02.

  4. Ticket change [81645c6200] (rid 228647) by sebres on 2024-07-14 23:57:19:

    1. icomment:
      The reason for the side effect is pretty simple - LoadCleanupProc uses Tcl_GetAssocData internally [.//info?name=288f7d23cad3c599d0840c5467616bcc9eb6ecc940c870210f413870e52fdfd0&ln=1217-1220|here] and because the hash entry is already removed, it gets NULL and so the clean-up doesn't invoke unload below and therefore leaking.
      
      Strange is that this was never noticed in 8.6, which was not affected by [34870ab5756911d1] and the hash entry removal were there before the call of the clean-up proc initially.
      
      I'll try to fix it if I identify all affected branches.
      
    2. login: "sebres"
    3. mimetype: "text/x-fossil-wiki"
  5. Ticket change [d8f1164ffb] (rid 228652) by sebres on 2024-07-15 01:22:57:

    1. closedate changed to: "2460506.55761219"
    2. closer changed to: "sebres"
    3. foundin changed to: "8.7+"
    4. icomment:
      Fixed in [24ace090aad63399] for 8.7 and merged to 9.0.
      
    5. login: "sebres"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"
  6. Ticket change [13c6b9f620] (rid 228674) by oehhar on 2024-07-15 19:49:21:

    1. closedate changed to: "2460507.32594037"
    2. closer changed to: "oehhar"
    3. icomment:
      Sergey, great work !
      Could you look into ticket [a7b7dd7927] which reports a segfault supposed to be caused by the fix?
      
      Thanks for all,
      Harald
      
    4. login: "oehhar"
    5. mimetype: "text/x-fossil-wiki"
    6. username: "oehhar"