]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #16952 : alexcrichton/rust/windows-large-console-write, r=brson
authorbors <bors@rust-lang.org>
Mon, 8 Sep 2014 20:51:14 +0000 (20:51 +0000)
committerbors <bors@rust-lang.org>
Mon, 8 Sep 2014 20:51:14 +0000 (20:51 +0000)
I've found that 64k is still too much and continue to see the errors as reported
in #14940. I've locally found that 32k fails, and 24k succeeds, so I've trimmed
the size down to 10000 which the included links in the added comment end up
recommending.

It sounds like the limit can still be hit with many threads in play, but I have
yet to reproduce this, so I figure we can wait until that's hit (if it's
possible) and then take action.

1  2 
src/libstd/io/stdio.rs

diff --combined src/libstd/io/stdio.rs
index bd837b6f7b5db39ef3d529eff227d2a392a206b5,9315ff12ca380c58f415bcd378b4616245c7f770..03e48ab79b144071f2fee6e09a4cd508572f8d4d
@@@ -203,7 -203,7 +203,7 @@@ fn with_task_stdout(f: |&mut Writer| -
          let mut my_stdout = local_stdout.replace(None).unwrap_or_else(|| {
              box stdout() as Box<Writer + Send>
          });
 -        let result = f(my_stdout);
 +        let result = f(&mut *my_stdout);
          local_stdout.replace(Some(my_stdout));
          result
      } else {
@@@ -362,7 -362,14 +362,14 @@@ impl Writer for StdWriter 
          // sizes. For an example, see #14940. For this reason, chunk the output
          // buffer on windows, but on unix we can just write the whole buffer all
          // at once.
-         let max_size = if cfg!(windows) {64 * 1024} else {uint::MAX};
+         //
+         // For some other references, it appears that this problem has been
+         // encountered by others [1] [2]. We choose the number 8KB just because
+         // libuv does the same.
+         //
+         // [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232
+         // [2]: http://www.mail-archive.com/log4net-dev@logging.apache.org/msg00661.html
+         let max_size = if cfg!(windows) {8192} else {uint::MAX};
          for chunk in buf.chunks(max_size) {
              try!(match self.inner {
                  TTY(ref mut tty) => tty.write(chunk),