Skip to content

Commit 325808a

Browse files
committed
auto merge of #16952 : alexcrichton/rust/windows-large-console-write, r=brson
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.
2 parents 0c73e5f + 198030f commit 325808a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/libstd/io/stdio.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,14 @@ impl Writer for StdWriter {
362362
// sizes. For an example, see #14940. For this reason, chunk the output
363363
// buffer on windows, but on unix we can just write the whole buffer all
364364
// at once.
365-
let max_size = if cfg!(windows) {64 * 1024} else {uint::MAX};
365+
//
366+
// For some other references, it appears that this problem has been
367+
// encountered by others [1] [2]. We choose the number 8KB just because
368+
// libuv does the same.
369+
//
370+
// [1]: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232
371+
// [2]: http://www.mail-archive.com/[email protected]/msg00661.html
372+
let max_size = if cfg!(windows) {8192} else {uint::MAX};
366373
for chunk in buf.chunks(max_size) {
367374
try!(match self.inner {
368375
TTY(ref mut tty) => tty.write(chunk),

0 commit comments

Comments
 (0)