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

Some very complex pipelines can cause a crash with std::bad_alloc #12

Open
mmomtchev opened this issue Dec 28, 2023 · 1 comment
Open

Comments

@mmomtchev
Copy link
Owner

With certain allocation patterns, when requesting very large numbers of Buffers, Node.js can crash with

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
Aborted

The problem has been known for a while:
nodejs/node#27715
nodejs/help#2414
nodejs/help#4156
nodejs/help#1544

It is caused by V8:
https://bugs.chromium.org/p/v8/issues/detail?id=9259

The issue seems to be quite rare, but when it happens it is reproducible - it is related to an interaction between a particular version of the g++ runtime - (g++-9) and V8 that is not well understood. Node.js is not affected starting from version 20. The failure happens because one of the hashtables of the GC grows the number of its buckets beyond the limit. A std::unordered_map will never release buckets even when calling std::unordered_map::clear. The failure is not related to the allocation of the ArrayBuffer itself at all - it is a failure when allocating handles in the GC.

@mmomtchev
Copy link
Owner Author

(alas, since I am still blocked from posting in Node.js because of the ongoing criminal affair, this message won't reach many of the people who reported this problem)

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

1 participant