Skip to content
Tcl Source Code History Of Ticket 8259d74a64
Login

History Of Ticket 8259d74a64

Artifacts Associated With Ticket 8259d74a64

  1. Ticket change [fefc9e01dd] (rid 217938) by apnadkarni on 2023-09-11 03:35:10:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      Exiting tclsh with an open handle to a file within a zipfs mount causes Tcl to panic.
      
      ```
      % zipfs mount ../tests/zipfiles/test.zip //zipfs:/test
      % set fd [open //zipfs:/test/test]
      zipfs_37_1
      % exit
      tried to unmount busy filesystem
      ```
      
    5. foundin initialized to: "8.7"
    6. is_private initialized to: "0"
    7. login: "apnadkarni"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "apnadkarni"
    14. subsystem initialized to: "- New Builtin Commands"
    15. title initialized to: "Tcl panic on exit if zipfs file is open"
    16. type initialized to: "Bug"
  2. Ticket change [12c5017288] (rid 218638) by apnadkarni on 2023-09-24 03:41:32:

    1. icomment: "Possibly caused by an attempt to fix [ba8845d272]"
    2. login: "apnadkarni"
    3. mimetype: "text/x-fossil-plain"
  3. Ticket change [b5fff10681] (rid 218941) by apnadkarni on 2023-09-30 03:59:09:

    1. closedate changed to: "2460217.66607941"
    2. closer changed to: "apnadkarni"
    3. icomment:
      Fixed in [a6562fe64a](https://core.tcl-lang.org/tcl/info/a6562fe64ac39b51).
      
      A longer term issue is that mountable file systems should be called after channels are closed in `TclFinalizeIOSubSystem`. However, there is no provision for doing so as exit handlers execute before. Because zipfs is in the core, this was fixed by removing the zipfs exit handlers and adding an explicit call to the zipfs finalization function from TFIOSS after channels are closed. For extensions that implement loadable modules it seems to me that an additional function needs to be added to `Tcl_FileSystem` dispatch table that is invoked as part of TFIOSS.
      
      That needs to be a future TIP.
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-markdown"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
  4. Ticket change [f5b74d16a9] (rid 219003) by dgp on 2023-10-02 14:43:43:

    1. closedate changed to: "2460220.11369758"
    2. closer changed to: "dgp"
    3. icomment:
      Checkin [a6562fe64a] contains new memory corruption crashes
      reported by the test suite.  One example error message is:
      
      Test file error: low guard byte 0 is 0x0         
      low guard byte 1 is 0x0          
      low guard byte 2 is 0x0          
      low guard byte 3 is 0x0          
      low guard byte 4 is 0x0          
      low guard byte 5 is 0x0          
      low guard byte 6 is 0x0          
      low guard byte 7 is 0x0          
      low guard byte 8 is 0x0          
      low guard byte 9 is 0x0          
      low guard byte 10 is 0x0         
      low guard byte 11 is 0x0         
      total mallocs                3985674
      total frees                  3959526
      current packets allocated      26148
      current bytes allocated      1511608
      maximum packets allocated      65066
      maximum bytes allocated      5607380
      low guard failed at 0x102f108, /home/dgp/fossil/tcl8.7/generic/tclZipfs.c 6261
      4 bytes allocated at (/home/dgp/fossil/tcl8.7/generic/tclObj.c 1786)
      Memory validation failure
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  5. Ticket change [d40b5b37ae] (rid 219004) by apnadkarni on 2023-10-02 16:19:36:

    1. closedate changed to: "2460220.18028183"
    2. closer changed to: "apnadkarni"
    3. icomment:
      Don,
      
      What build configuration are you using?
      
      I run the following combinations on Linux and Windows before commits and none showed the error you are seeing.
      
      Linux:
      
      ```
      ../configure CFLAGS=-DPURIFY --enable-symbols && make clean && make valgrind 
      and
      rm -rf * && ../configure --enable-symbols=mem && make test
      ```
      
      On Windows
      
      ```
      nmake /f makefile.vc STATS=memdbg
      ```
      
      I thought that would suffice to catch these kinds of errors.
      
      I reran the above again on core-8-branch as well as that specific commit and still don't see the errors. 
      
      If you can post the specific configuration and make command, I'll try that.
      
      /Ashok
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-markdown"
  6. Ticket change [fe6bb8d635] (rid 219009) by dgp on 2023-10-02 16:55:41:

    1. closedate changed to: "2460220.20534065"
    2. closer changed to: "dgp"
    3. icomment:
      
      $ fossil status
      ...
      checkout:     a6562fe64ac39b51b8ba05dbf31f77ba8be27a70 2023-09-30 03:23:45 UTC
      ...
      comment:      Fix [8259d74a64] - panic on exit (user: apnadkarni)
      
      $ ../unix/configure --disable-shared --enable-symbols=mem
      ...
      $ make test-tcl TESTFLAGS="-file unixNotfy.test"
      ...
      unixNotfy.test
      Test file error: low guard byte 0 is 0x0         
      low guard byte 1 is 0x0          
      low guard byte 2 is 0x0          
      low guard byte 3 is 0x0          
      low guard byte 4 is 0x0          
      low guard byte 5 is 0x0          
      low guard byte 6 is 0x0          
      low guard byte 7 is 0x0          
      low guard byte 8 is 0x0          
      low guard byte 9 is 0x0          
      low guard byte 10 is 0x0         
      low guard byte 11 is 0x0         
      total mallocs                1068301
      total frees                  1043382
      current packets allocated      24919
      current bytes allocated      1427710
      maximum packets allocated      33968
      maximum bytes allocated      1969189
      low guard failed at 0x7f50d80e3068, /home/dgp/fossil/tcl8.7/generic/tclZipfs.c 6261
      6 bytes allocated at (/home/dgp/fossil/tcl8.7/generic/tclZipfs.c 2151)
      Memory validation failure
      
      Tests ended at Mon Oct 02 12:51:17 EDT 2023
      all.tcl:        Total   4       Passed  2       Skipped 2       Failed  0
      Sourced 1 Test Files.
      Number of tests skipped for each constraint:
              2       nonPortable
      
      Test files exiting with errors:  
      
        unixNotfy.test
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  7. Ticket change [340999e721] (rid 219010) by apnadkarni on 2023-10-02 17:16:22:

    1. closedate changed to: "2460220.21970625"
    2. closer changed to: "apnadkarni"
    3. icomment:
      OK, I see at least one difference in environment. You have the Thread package available, I don't and neither does github actions. Will try installing the package tomorrow and retry.
      
      Could you please post the version of Thread that you have? I'd prefer to clone your environment as closely as possible to reproduce the issue.
      
      /Ashok
      
    4. login: "apnadkarni"
    5. mimetype: "text/plain"
  8. Ticket change [252ea4ac8b] (rid 219011) by dgp on 2023-10-02 17:23:43:

    1. closedate changed to: "2460220.2248034"
    2. closer changed to: "dgp"
    3. icomment:
      
      $ fossil status
      ...
      checkout:     6088b582180f46d5caee900d5e8f7a19348b8c49 2023-09-11 15:29:15 UTC
      ...
      tags:         thread-2-8-branch
      comment:      No longer support "utf16" build mode (not used by Thread anyway)
      
    4. login: "dgp"
    5. mimetype: "text/plain"
  9. Ticket change [2cca60dfa4] (rid 219012) by apnadkarni on 2023-10-02 17:38:08:

    1. closedate changed to: "2460220.23481808"
    2. closer changed to: "apnadkarni"
    3. icomment:
      I *think* I know what the problem is. The undocumented `tcl::zipfs::fallbackEntryEncoding` variable is linked via `Tcl_LinkVar` to the global `ZipFS.fallbackEntryEncoding` C variable at initialization and then freed twice (once by each thread).
      
      I'm also not sure if it is valid to `Tcl_LinkVar` to the same `TCL_STRING_VALUE` from two different threads. Seems to me that is a race condition.
      
      I'll attempt to reproduce to confirm that is the issue before fixing.
      
      (Previous to that commit, the string was not being freed at all on exit.)
      
    4. login: "apnadkarni"
    5. mimetype: "text/x-markdown"
  10. Ticket change [0bfb115c8e] (rid 219019) by apnadkarni on 2023-10-03 04:18:10:

    1. closedate changed to: "2460220.6792938"
    2. icomment:
      Reproduced and fixed in branch apn-memory-fix. Building with threads does show the following errors:
      
      ```
      ==== Test with ThreadLevel 2 ====
      Test file error: http.test bgerror
      invalid command name "::http::104--SocketCoroutine"
      invalid command name "::http::104--SocketCoroutine"
          while executing
      "::http::104--SocketCoroutine"
          ("after" script)
      http.test bgerror
      invalid command name "::http::158--SocketCoroutine"
      invalid command name "::http::158--SocketCoroutine"
          while executing
      "::http::158--SocketCoroutine"
          ("after" script)
      
      Tests ended at Tue Oct 03 09:20:13 IST 2023
      all.tcl:        Total   528     Passed  522     Skipped 6       Failed  0
      Sourced 1 Test Files.
      Number of tests skipped for each constraint:
              3       knownBug
              3       nonPortable
      
      Test files exiting with errors:
      
        http.test
      ```
      
      However, these also show up in commit [b3c4b1cf907] prior to the original fix for the panic so I presume they are unrelated.
      
      As an aside, I believe there are other potential multithreading issues in zipfs that need to be looked at once the basic fixes are done.
      
    3. login: "apnadkarni"
    4. mimetype: "text/x-markdown"
  11. Ticket change [afb9995234] (rid 219022) by apnadkarni on 2023-10-03 05:40:20:

    1. closedate changed to: "2460220.73634999"
    2. icomment: "Merged fix into [e232836cee]."
    3. login: "apnadkarni"
    4. mimetype: "text/plain"