-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fatal Error (Abort) creating string larger than 268435440 bytes #1374
Comments
this is ~256mb |
@trevnorris @chrisdickinson and I are already working on this FWIW |
If your file is just using ascii, you can work around this currently by specifying |
I feel like this has already been reported, but I can't find the issue.. |
here is a stacktrace i get on linux:
|
updated the title, the issue is obviously the |
@juliangruber ah. Is this related to #649? |
@Fishrock123 yes, there is even a same issue reported deep in the comments. It's not a v8 issue, while v8 does have a smallish limit for strings allocated in the js-heap (the 268mb or so), it is our fault for trying to allocate the string in js-heap in the first place. |
This doesn't seem to be an issue with the new Buffer rewrite / removal of smalloc: brendanashworth in ~ $ node -v
v2.1.0
brendanashworth in ~ $ node test
1073741823 'kMaxLength'
268435440 'ok'
FATAL ERROR: invalid array length Allocation failed - process out of memory
Abort trap: 6 brendanashworth in ~ $ node -v
v3.0.0
brendanashworth in ~ $ node test
268435440 'ok'
268435441 'ok' Closing this for now, feel free to reopen if I'm wrong! :) |
This isn't an issue of the smalloc change, but it is an issue. The fix is just about to be landed in #2402 |
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: #1374 PR-URL: #2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Fixed by 617ee32. |
@rvagg Adding this to the v4.0.0 milestone because it's a patch that prevents a possible segfault. |
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: #1374 PR-URL: #2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: nodejs#1374 PR-URL: nodejs#2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: #1374 PR-URL: #2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Amended by @rvagg to change author date from "1970-08-16 16:09:02 +0200" to "2015-08-16 16:09:02 +0200" as per discussion @ #2713
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: #1374 PR-URL: #2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Amended by @rvagg to change author date from "1970-08-16 16:09:02 +0200" to "2015-08-16 16:09:02 +0200" as per discussion @ #2713
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: #1374 PR-URL: #2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Amended by @rvagg to change author date from "1970-08-16 16:09:02 +0200" to "2015-08-16 16:09:02 +0200" as per discussion @ #2713
v8 will silently return an empty handle which doesn't delete our data if string length is above String::kMaxLength Fixes: #1374 PR-URL: #2402 Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Amended by @rvagg to change author date from "1970-08-16 16:09:02 +0200" to "2015-08-16 16:09:02 +0200" as per discussion @ #2713
I believe this should be reopened. Output under v4.1.1 is: 268435440 'ok'
buffer.js:378
throw new Error('toString failed');
^
Error: toString failed
at Buffer.toString (buffer.js:378:11)
at Object.<anonymous> (/Users/michael/github/rss/data/test.js:6:24)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:117:18)
at node.js:951:3 |
@mhart This issue is about node aborting on large strings. It no longer does, it throws a catchable exception. |
OK, I was going by the expected output in the issue description. |
i am getting the same issue ,
|
Given this script:
The output should be:
But it actually is:
The text was updated successfully, but these errors were encountered: