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

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #1819

Closed
zq99299 opened this issue Aug 30, 2019 · 11 comments · Fixed by #2953
Closed

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory #1819

zq99299 opened this issue Aug 30, 2019 · 11 comments · Fixed by #2953
Assignees

Comments

@zq99299
Copy link

zq99299 commented Aug 30, 2019

  • [ x] I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

What is expected?

Normal build

What is actually happening?

sh deploy.sh
$ npx --max_old_space_size=8192 vuepress build docs
wait Extracting site metadata...

.....

Language does not exist tip
wait Rendering static HTML...
Rendering page: /elasticsearch-senior/depth-search/11-dis-max-best-fields.html
<--- Last few GCs --->

[8980:000002394C5333A0]   373053 ms: Mark-sweep 1368.8 (1442.2) -> 1368.8 (1442.2) MB, 1347.0 / 0.0 ms  allocation failure GC in old sp
ace requested
[8980:000002394C5333A0]   374704 ms: Mark-sweep 1368.8 (1442.2) -> 1368.8 (1427.2) MB, 1574.2 / 0.0 ms  last resort GC in old space req
uested
[8980:000002394C5333A0]   376188 ms: Mark-sweep 1368.8 (1427.2) -> 1368.8 (1427.2) MB, 1484.7 / 0.0 ms  last resort GC in old space req
uested


<--- JS stacktrace --->

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

Security context: 0000019575F25879 <JSObject>
    2: exec(this=000000FD275E10B1 <JSRegExp <String[40]: ^\/cache-pdp\/dr\/131\.html(?:\/(?=$))?$>>,0000026741B33FA9 <String[62]: /elas
ticsearch-senior/depth-search/11-dis-max-best-fields.html>)
    3: 0000008D3FABD9D1 <Symbol: Symbol.match>(aka [Symbol.match])(this=000000FD275E10B1 <JSRegExp <String[40]: ^\/cache-pdp\/dr\/131\.
html(?:\/(?=$))?$>>,0000026741B33FA9 <String[62]: /elasticsearch-s...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node_module_register
 2: v8::internal::FatalProcessOutOfMemory
 3: v8::internal::FatalProcessOutOfMemory
 4: v8::internal::Factory::NewCodeRaw
 5: v8::internal::Factory::NewCode
 6: v8::internal::compiler::Linkage::GetSimplifiedCDescriptor
 7: v8::internal::RegExpImpl::Exec
 8: v8::internal::RegExpImpl::Exec
 9: v8::internal::RegExpImpl::Exec
10: v8::internal::RegExpImpl::Exec
11: v8::internal::RegExpImpl::Exec
12: v8::internal::RegExpImpl::Exec
13: v8::internal::interpreter::BytecodeArrayRandomIterator::UpdateOffsetFromIndex
14: 0000029C5CD843C1
error Command failed with exit code 3.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Other relevant information

An error occurred while building the repository:https://github.com/zq99299/note-book

@zq99299 zq99299 closed this as completed Aug 30, 2019
@zq99299 zq99299 reopened this Aug 30, 2019
@flozero
Copy link
Collaborator

flozero commented Sep 6, 2019

you are running a huge docs. I think it's more relevant to your node env actually and the size of your docs that is really really big

@zq99299
Copy link
Author

zq99299 commented Sep 9, 2019

Node --max_old_space_size=4096 is used in package.json

  "scripts": {
    "docs:devx": "vuepress dev docs --open",
    "docs:dev": "node --max_old_space_size=4096 ./node_modules/vuepress/cli.js dev docs --open",
    "docs:buildx": "vuepress build docs --debug",
    "docs:build": "node --max_old_space_size=4096 ./node_modules/vuepress/cli.js build docs"
  },

Once this problem is resolved, it is still expected to be specified by configuration

@flozero
Copy link
Collaborator

flozero commented Sep 9, 2019

Did you resolve it ? If yes we should add it in the FAQ

@flozero
Copy link
Collaborator

flozero commented Sep 10, 2019

i think a big issue here is that we are using readFile instead of stream. The readfile will wait till all the content has been readen. The second aspect problem is when the file is read we save in memory a huge object containing the content.

But i actually can't figure out how to implement readstream i will need to test solution

@zq99299
Copy link
Author

zq99299 commented Sep 10, 2019

Did you resolve it ? If yes we should add it in the FAQ
Yes, it worked, with node --max_old_space_size=4096

@flozero
Copy link
Collaborator

flozero commented Sep 10, 2019

Ok but it's definitely just a temp fix

@zq99299
Copy link
Author

zq99299 commented Sep 10, 2019

Thank you, my document does seem to be a little large, I want to wait for a certain number of articles on a certain topic when the number of a separate project

@flozero
Copy link
Collaborator

flozero commented Sep 10, 2019

the solution would be to add a combo of child process and stream

@flozero
Copy link
Collaborator

flozero commented Sep 11, 2019

i will work on a workaround but it will take time @zq99299 i will update this thread if i have informations

@mimers
Copy link

mimers commented May 10, 2021

i will work on a workaround but it will take time @zq99299 i will update this thread if i have informations

is there any update now in 2021?

@zq99299
Copy link
Author

zq99299 commented May 11, 2021

For large documents, this can be difficult to solve because of the build pains, I have split up 10 or so repositories

对超大文档,构建吃力,这个可能很难解决,我都拆分了 10 来个仓库了

ulivz pushed a commit that referenced this issue Jan 15, 2022
* feat: add build concurrency control

* fix: rm comment

* feat: docs

Co-authored-by: genefy <ziheng.dzh@alibaba-inc.com>
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

Successfully merging a pull request may close this issue.

3 participants