Skip to content

src: make NearHeapLimitCallback() more robust

Instead of removing the callback before generating heap snapshot and then adding it back after the heap snapshot is generated, just remove it once the heap snapshot limit is reached. Otherwise if the worker callback kicks in and sets the heap limit to higher value during the heap snapshot generation, the current_heap_limit in the heap snapshot callback becomes invalid, and we might return a heap limit lower than the current one, resulting in OOM.

In addition add more logs and checks in Worker::NearHeapLimit() to help us catch problems.

Refs: https://github.com/nodejs/reliability/issues/372

Merge request reports

Loading