Closed korostylov closed 1 year ago
Hi @korostylov thanks for raising this. I'm afraid it's a resource constraint issue. The stack trace you're seeing is from nodejs + v8. If there's no way to split up the file, you'll need to look at increasing the resources assigned to nodejs. This thread on stack overflow explains how to do this: https://stackoverflow.com/questions/74927384/nodejs-reached-heap-limit-allocation-failed-javascript-heap-out-of-memory.
We probably could handle this a little more elegantly by checking the size of the file you're providing, but mdpdf can't actually do anything to resolve the resource limit issue itself, it's something you will need to do as the user.
Thanks for the answer. I thought that fixing this would be easy as 'Markdown PDF' extension in VSCode can do this. After adding the 'NODE_OPTIONS' to environment variables it failed with timeout :-) (30000ms) After I increased this timeout to 100s, rendering without any options was successful. Rendering with options like CSS styles was not successful even with 400s timeout :-)
When I'm trying to convert a big markdown file with 25000+ strings I got the following error:
<--- Last few GCs ---> 75[34888:0000025ED6D7FEF0] 15894 ms: Mark-sweep (reduce) 4097.7 (4107.0) -> 4094.7 (4104.0) MB, 3.6 / 0.0 ms (+ 4.1 ms in 1 steps since start of marking, biggest step 4.1 ms, walltime since start of marking 10 ms) (average mu = 0.501, current mu = 0.424[34888:0000025ED6D7FEF0] 15906 ms: Mark-sweep (reduce) 4098.2 (4107.5) -> 4098.2 (4107.5) MB, 8.9 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 10 ms) (average mu = 0.417, current mu = 0.308
<--- JS stacktrace --->
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF66E951ADF node_api_throw_syntax_error+203775 2: 00007FF66E8D14B6 SSL_get_quiet_shutdown+63558 3: 00007FF66E8D2822 SSL_get_quiet_shutdown+68530 4: 00007FF66F372F34 v8::Isolate::ReportExternalAllocationLimitReached+116 5: 00007FF66F35E2A2 v8::Isolate::Exit+674 6: 00007FF66F1E02FC v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124 7: 00007FF66F1DD51B v8::internal::Heap::CollectGarbage+3963 8: 00007FF66F1F3753 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099 9: 00007FF66F1F3FFD v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93 10: 00007FF66F203833 v8::internal::Factory::NewFillerObject+851 11: 00007FF66EEF4F65 v8::internal::DateCache::Weekday+1349 12: 00007FF66F4105C1 v8::internal::SetupIsolateDelegate::SetupHeap+558193 13: 00007FF66F42BB13 v8::internal::SetupIsolateDelegate::SetupHeap+670147 14: 00007FF5EF5E14E2