nodejs / nodejs/node

node only using half of the available memory

オープン
#35,573 コメント 15 件 リアクション 12 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

memory never-stale
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

  • Version: 12.19.0
  • Platform: Debian Buster
  • Subsystem:
What steps will reproduce the bug?
  1. Start a container with limited memory (something like docker run --rm -it --memory=1G --memory-swap=1G node:12.19.0-buster-slim bash
  2. Inspect heap size (node -e 'const v8 = require("v8"); console.log(v8.getHeapStatistics());')
How often does it reproduce? Is there a required condition?

100%

What is the expected behavior?

node would use all available memory

What do you see instead?

node is only using half of the memory, so we either need to give the container twice as much memory as we really want it to use (which is problematic) or also specify --max-old-space-size in addition to controlling the container which means we have to keep 2 different settings in sync and that's a big pain

Additional information

It appears that it was changed here, and only using half of memory makes sense when running on a system with multiple process, but when running in a docker container, using all of the memory allocated to the container makes more sense

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、提供された docker run コマンドと node -e v8.getHeapStatistics() の確認を使って問題を再現します。Node.js がコンテナのメモリ上限をどのように判定しているかを追跡し、その値を想定される 1G の割り当てと比較します。完了の条件は、別途 --max-old-space-size を設定しなくても、ランタイムがヒープを適切なサイズに設定することです。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, javascript, linux, node.js
領域
backend, devops, performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。