Node: The max length of console.log output is 8275

Created on 11 Nov 2016  路  12Comments  路  Source: nodejs/node

  • Version: 7.1.0
  • Platform: Windows 10 1607 (Redstone) 14393.447 x64
  • Subsystem: console

Using the following codes, the second console.log will be failed without any error message and the program exits; but it worked on 7.0.0.

"use strict";

// length = 8275, Array(8276) is max.
var testString = Array(8277).join('a');
console.log('length = ' + testString.length);
console.log(testString);

Reduce the array size to 8276, the program works as expected.

confirmed-bug libuv windows

Most helpful comment

I'm having the same problem on both Windows 10 build 14965 and Windows Server 2016. My app suddenly exited without displaying any error message, at where a very long string should be console.log'd, after upgraded node to 7.1.0.

@Fishrock123 @killroy42 I took some time to do the bisect and tested out the patch, libuv 1.10.0 upgrade IS the cause of the problem and the patch FIXES it.

All 12 comments

Can't reproduce on Windows 7 x64 with cmd or Powershell.

var testString = Array(8276).join('a');
console.log('length = ' + testString.length);
console.log(testString);
console.log('finished');

Use the codes above, the second console.log works but the third fails without any error message and the program exits.

Change to Array(8192).join('a'), the third works.

Can't reproduce as well.

Start Node.js command prompt, and execute the following command:

D:\>node -p "process.stdout.write(util.format.apply(null, [Array(8278).join('a')]))"

Nothing output, but if you change the array size to Array(8277), it works.

For me, it does print all the string even with 8278.

Irrelevant:
Just a shot in the Dark Can it be 32bit limit if your running on a 32bit system

Can confirm the same blank output on my machine.

Windows 10 RS1 x64 + Node.js 7.1.0

Does anything change if you wait for some time before exiting? E.g. do a setTimeout(()=>{},5000) afterwards. Could be related to #6456.

Repro'd.

As the OP said this appears in 7.1.0. It is probably tangentially related to #6456 but something else must have changed here.

I bet it was the libuv 1.10.0 upgrade...

Unfortunately I am unable to bisect on Windows so... @saghul, @cjihrig, @bnoordhuis

Edit: Adding a timeout does not help, probably _not_ related to #6456.

Does it work with the patch from issue#9542?

I'm having the same problem on both Windows 10 build 14965 and Windows Server 2016. My app suddenly exited without displaying any error message, at where a very long string should be console.log'd, after upgraded node to 7.1.0.

@Fishrock123 @killroy42 I took some time to do the bisect and tested out the patch, libuv 1.10.0 upgrade IS the cause of the problem and the patch FIXES it.

Closing. #9542 closed via https://github.com/libuv/libuv/commit/d0c26414b4287628b2fef25aa7e3971240a92383. Please reopen if that is not correct.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

willnwhite picture willnwhite  路  3Comments

srl295 picture srl295  路  3Comments

Icemic picture Icemic  路  3Comments

mcollina picture mcollina  路  3Comments

filipesilvaa picture filipesilvaa  路  3Comments