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

History Of Ticket 219148ffffffffff

Artifacts Associated With Ticket 219148ffffffffff

  1. Ticket change [8d6422fbbe] (rid 127918) by nobody on 2000-10-26 05:02:19:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 948 Bug
      Version: 8.0.3
      SubmitDate: '1998-12-14'
      LastModified: '2000-06-22'
      Severity: MED
      Status: Assigned
      Submitter: pat
      ChangedBy: hobbs
      OS: Windows NT
      Machine: X86
      FixedDate: '2000-10-25'
      ClosedDate: '2000-10-25'
      
      
      Name: Uwe Traum
      
      ReproducibleScript:
      
      proc dotest {{filename test.bin}} {
          set fid [open $filename w]
          fconfigure $fid -translation binary
      
          for { set i 0 } { $i < 2000 } { incr i } {
              set ind [expr {128*int(rand()*30000)}]
              #seek $fid $ind start
              puts -nonewline $fid "123456789012345678901234567890"
          }
          close $fid
      }
      time dotest 3
      
      [rewritten by hobbs as proc]
      
      ObservedBehavior:
      Output:
      
      NT4;local disk;PentiumPro 200: 155172000 microseconds per iteration
      Solaris2.5;local disk;sparc20: 1844860 microseconds per iteration
      
      on unix it's 80 time faster than on NT!!!
      
      DesiredBehavior:
      same speed
      
      
      In FileOutputProc (tcl8.0.3/win/tclWinChan.c,line 560) there
      is ALWAYS a call to FlushFileBuffers. 
      So every I/O is written directly to disk. 
      That's why the Disk-LED is permanently blinking.
      
      What's the reason for this call ?
      Can it be removed ?
      
      thanks 
      --
      This is verified in 8.4a1.  The disk LED does stay permanently
      on under NT.  Using the Performance Monitor, it does seem that
      excessive flushing may be occuring.
       
      -- 06/22/2000 hobbs
      
    4. foundin initialized to: "obsolete: 8.0.3"
    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: "62. (unused)"
    10. title initialized to: "IO_PERFORMANCE on NT 80 times slower then on unix"
    11. type initialized to: "Bug"
  2. Ticket change [7aa23ea5d1] (rid 90362) by andreas_kupries on 2000-11-17 16:42:55:

    1. priority changed to: "6"
  3. Ticket change [d55894cd3f] (rid 123603) by davygrvy on 2001-01-13 07:35:16:

    1. icomment:
      File channel driver on Win* forces a flush.  It really doesn't need to, but some file tests depend on it doing a true write to disk.  So therefore, it's slower.
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  4. Ticket change [fd3ca672c2] (rid 108380) by dkf on 2001-02-01 03:45:41:

    1. icomment:
      See also Bug #119300 - we've so many unclosed bugs that it is impractical to link related ones... <sigh>)
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. subsystem changed to: "27. Channel Types"
    5. username: "dkf"
  5. Ticket change [fd14b152f4] (rid 108350) by andreas_kupries on 2001-08-24 03:13:53:

    1. assignee changed to: "andreas_kupries"
  6. Ticket change [2697a7241f] (rid 88371) by andreas_kupries on 2001-08-24 04:40:22:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      The actual id is #219300 after SF did its renumbering dance.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  7. Ticket change [35e98ae649] (rid 107022) by andreas_kupries on 2001-08-24 05:55:32:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      This is the list of tests which fail if flushing is 
      disabled in the windows file driver:
      
      io-27.2 FlushChannel, some output buffered
      io-27.4 FlushChannel, implicit flush when buffer fills
      io-27.5 FlushChannel, implicit flush when buffer fills and 
      on close
      io-29.4 Tcl_WriteChars, buffering in full buffering mode
      io-29.5 Tcl_WriteChars, buffering in line buffering mode
      io-29.6 Tcl_WriteChars, buffering in no buffering mode
      io-29.7 Tcl_Flush, full buffering
      io-29.8 Tcl_Flush, full buffering
      io-29.17 Tcl_WriteChars buffers, then Tcl_Flush flushes
      io-29.18 Tcl_WriteChars and Tcl_Flush intermixed
      io-29.19 Explicit and implicit flushes
      io-29.20 Implicit flush when buffer is full
      io-29.28 Tcl_WriteChars, lf mode
      io-39.6 Tcl_SetChannelOption, multiple options
      io-39.7 Tcl_SetChannelOption, buffering, translation
      io-39.8 Tcl_SetChannelOption, different buffering options
      io-52.7 TclCopyChannel
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  8. Ticket change [2f21037727] (rid 93006) by andreas_kupries on 2001-08-24 06:26:34:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Ok, I now understand the problem much better. It is 
      partially an OS issue and partially an issue of how the 
      affected tests were written.
      
      When Tcl 'flushes' a channel it actually only writes its 
      internal buffers to the OS and then forgets about the data. 
      The OS is free to delay the actual write to disk.
      
      The affected tests try to check that the flushing behaviour 
      of tcl is correct. To do so they perform some writes and 
      then check the size of the resulting file.  But this 
      meansthat they actually check the flushing behaviour of Tcl 
      itself and how the OS deals with pending data when it comes 
      to reporting the size of a file.
      
      Both Unix and Win* platforms delay writing data to disk 
      until they have idle time, or by grouping nearby block 
      together, etc. But obviously Win* is more lazy than Unix 
      when it comes to reporting the size of a file with pending 
      writes. Win* reports the size actually on disk, no matter 
      how much data is pending. Unix goes to the trouble and 
      calculates the size of the file as if the pending data had 
      been written to the disk.
      
      The current solution of this problem is to force Win* to 
      actually write all the data written to it by Tcl to the 
      disk too, without delay. This gets us the reliable file 
      sizes the tests need to perform correctly, at the expense 
      of general I/O performance.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  9. Ticket change [604e4bbace] (rid 115970) by nobody on 2001-08-24 06:48:40:

    1. icomment:
      Logged In: NO 
      
      I agree 100% with your summary.
      
      
    2. login: "nobody"
    3. mimetype: "text/plain"
    4. username: "nobody"
  10. Ticket change [49ee54ffdc] (rid 126454) by andreas_kupries on 2001-08-24 07:17:07:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Just for the record here are the results of running tclbench
      for a tclsh with forced flushing (1) and without (2) for my 
      machine (Win NT 5, 128 MB). Used fcopy to exercise the I/O 
      system.
      
      $ ./tcl/win/win-dll/tclsh84.exe tclbench/runbench.tcl \
           -match 'FCOPY*' -notk \
           -paths "./tcl/win/win-dll/ ./tcl.nf/win/win-dll/"
      
      000 VERSIONS:            1:8.4a4 2:8.4a4
      001 FCOPY binary: 164K   2320137   19575
      002 FCOPY encoding: 164K 1583793   39857
      003 FCOPY std: 164K      2435353   18588
      003 BENCHMARKS           1:8.4a4 2:8.4a4
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  11. Ticket change [6ac42712fe] (rid 128208) by andreas_kupries on 2001-08-24 07:27:30:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Ideas to solve this problem collected so far.
      ________________________________________
      Just remove the forced OS flush for
      Windows. Make the tests 'unixOnly'.
      
      Anticipated Effects:
      
      -Speedup for Windows I/O compared to
      current solution.
      
      -No change for the other platforms.
      
      -The coverage of code paths by the
      testsuite decreases. In other words,
      the testsuite becomes worse.
      ________________________________________
      Add counters in the channel structures
      (on the driver side) to count how many
      bytes were read and written to the OS.
      
      Add testchannel subcommands to access this
      information instead of using [file size].
      
      The tests will have to be rewritten.
      
      Anticipated Effects:
      
      -General slowdown in the I/O system
      for all platforms (Counter management).
      Should be negligible though.
      
      -Speedup for Windows I/O compared to
      current solution.
      
      -The testsuite stays in shape.
      ________________________________________
      Handle the proposed counters only for Win*.
      Write separate tests for Unix and Win*
      
      Anticipated Effects:
      
      -Speedup for Windows.
      
      -No change for the other platforms.
      
      -The testsuite stays in shape.
      ________________________________________
      Add a boolean flag to the Win* structures
      (driver side). Indicates if a true flush
      was done on the file channel.
      
      Whenever a [file size] is requested the
      system goes through the list of file
      channels and does an OS flush on all with
      the flag not set. The flag is set by this
      action. Any write on the channel resets
      the flag for that channel. When closing a
      file channel do a true flush in the driver.
      
      The testsuite needs no change.
      
      Anticipated Effects:
      
      -Slowdown of [file size] operation
      for Win*.
      
      -Speedup of Win* I/O in general.
      
      -No change for the other platforms.
      
      -Essentially emulates Unix behaviour
      on Windows for Tcl.
      
      -Adds interaction between the
      filesystem and the I/O (channel)
      code.
      
      -The testsuite stays in shape.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  12. Ticket change [aab4b9f273] (rid 100974) by andreas_kupries on 2001-08-24 07:30:06:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      More ideas (coming from Jeff).
      ________________________________________
      What happens on Windows if another process
      opens the file ? Does that process also
      get the bogus file size ?
      ________________________________________
      Are there Win* APIs we could use to peek
      into the buffering done by Windows ?
      We could use this instead of the counters.
      
      Or we could use this in [file size] to
      report a better size.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  13. Ticket change [667c254430] (rid 102721) by andreas_kupries on 2001-09-05 07:20:47:

    1. icomment:
      Logged In: YES 
      user_id=75003
      
      Ideas from David Graveraux: 
      
      The only thing I know is that if there's uncommitted 
      buffers the OS holding, a
      request for file size won't cause the OS to commit the 
      buffers first.
      
      A look at using I/O completion ports for writing to disk 
      from within Tcl >might<
      be a good work-around for tracking what the OS hasn't 
      committed yet.  I can't
      say for sure.  The amount of code for tracking could get 
      very large.  Adding an
      explicit flush to the channel driver might be the best 
      alternative, but explicit
      at the script level to the user instead of the implicit one 
      as is now.
      
      That's all I know.
      
      >Hm. We have a flushproc in the driver, it is just not used 
      yet. This
      >could contain the OS-Flush on windows and be called by 
      [flush] after
      >it has committed the tcl buffers to the OS. This does not 
      help with the
      >test which check file sizes to check the correctness 
      the 'implicit'
      >flushes. And the moment we add the OS-flush to them we are 
      back to the
      >current situation.
      
      half way there...  add a [flush] to the tests, that will do 
      FlushFileBuffers()
      or whatever was the API func...
      
      It's not the same.  Make [flush] not only flush the channel 
      but commit the OS
      buffers, too.  Normal mode flushing of the channel buffer 
      doesn't have to also
      mean flushing the OS buffers, too.
      
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  14. Add attachment "219148.patch" [53ebff77f7] (rid 93842) by andreas_kupries on 2001-09-07 06:46:25.

  15. Ticket change [a3258f56a7] (rid 110007) by andreas_kupries on 2001-09-07 06:46:25:

    1. icomment:
      
      
      File Added - 10463: 219148.patch
      
      Logged In: YES 
      user_id=75003
      
      Added a patch solving the problem. Used the idea of a 
      boolean flag and flushing only the channels which were 
      written too and only when requesting size information.
      
      
    2. login: "andreas_kupries"
    3. mimetype: "text/plain"
    4. username: "andreas_kupries"
  16. Ticket change [5edddf9612] (rid 115707) by hobbs on 2001-09-07 07:01:38:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      Looks great.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  17. Ticket change [9e77af7a90] (rid 96475) by andreas_kupries on 2001-09-08 00:11:51:

    1. closedate changed to: "2001-09-07T17:11:51"
    2. closer changed to: "andreas_kupries"
    3. icomment:
      Logged In: YES 
      user_id=75003
      
      Committed to both head and core-8-3-1-branch.
      
      
      
    4. login: "andreas_kupries"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "andreas_kupries"