Skip to content
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

async version of fs utils causes OOM (but not sync) (faulty Promises?) #652

Closed
yurydelendik opened this issue Jun 1, 2017 · 1 comment
Closed

Comments

@yurydelendik
Copy link

Moved from nodejs/node#13337

  • Version: v6.9.4
  • Platform: Darwin Kernel Version 16.5.0
  • Subsystem:

Based on mozilla/pdf.js#8419

STR:

  1. clone https://github.com/yurydelendik/nodesegfault && npm install
    2.node pdf2svg.js

Expected result:
No node fatal error

Actual result:

...
<--- Last few GCs --->

   34764 ms: Mark-sweep 1149.4 (1215.2) -> 1148.8 (1190.2) MB, 14.0 / 0.0 ms [allocation failure] [GC in old space requested].
   34775 ms: Mark-sweep 1148.8 (1190.2) -> 1148.4 (1190.2) MB, 11.1 / 0.0 ms [allocation failure] [GC in old space requested].
   34794 ms: Mark-sweep 1148.4 (1190.2) -> 1148.4 (1156.2) MB, 18.9 / 0.0 ms [last resort gc].
   34802 ms: Mark-sweep 1148.4 (1156.2) -> 1148.4 (1156.2) MB, 7.7 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x2684b5fcfb51 <JS Object>
    1: DoJoin(aka DoJoin) [native array.js:~129] [pc=0x45ab5998cec] (this=0x2684b5f04381 <undefined>,w=0x181e368c7f29 <JS Array[36]>,x=36,N=0x2684b5f043c1 <true>,J=0x2684b5f04411 <String[0]: >,I=0x2684b5fb46e1 <JS Function ConvertToString (SharedFunctionInfo 0x2684b5f52dc9)>)
    2: Join(aka Join) [native array.js:180] [pc=0x45ab590e3b2] (this=0x2684b5f04381 <undefined>,w=0x181e368c7f29 <JS Arr...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [/opt/local/bin/node]
 2: node::FatalException(v8::Isolate*, v8::Local<v8::Value>, v8::Local<v8::Message>) [/opt/local/bin/node]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [/opt/local/bin/node]
 4: v8::Utils::ApiCheck(bool, char const*, char const*) [/opt/local/bin/node]
 5: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [/opt/local/bin/node]
 6: v8::internal::Factory::NewRawTwoByteString(int, v8::internal::PretenureFlag) [/opt/local/bin/node]
 7: v8::internal::Runtime_StringBuilderConcat(int, v8::internal::Object**, v8::internal::Isolate*) [/opt/local/bin/node]
 8: 0x45ab54092a7
Abort trap: 6

Works fine when sync versions of writeFile or mkdir used (see mozilla/pdf.js#8461)

New finding: using non-native Node.js promises fixes the issue as well, e.g. global.Promise = undefined; forces to use PDF.js polyfill. This means there is no critical OOM leak on PDF.js side.

@Rob--W
Copy link

Rob--W commented Jun 18, 2017

This can be closed. The explanation for the OOM is at mozilla/pdf.js#8540 and mozilla/pdf.js#8461 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants