Sentry.Sources keeps the decoded source-code map on its heap after loading it into ETS
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
まず Sentry.Sources.handle_continue/2 を読み、特にパッケージ化されたマップをデコードしてエントリを ETS に挿入する :load_source_code_map 節を確認してください。GenServer コールバックのテストを調べ、読み込み後にプロセスがデコード済みマップを解放し、ETS エントリは引き続き利用できることを確認してください。Issue にはテストファイルが指定されていないため、リポジトリ内で関連するテストを探してください。
索引モデルが issue の本文から書いたものです。
説明
Environment
- sentry 13.4.2, Elixir 1.20.4 / OTP 29.1.1,
enable_source_code_context: true - Release with a packaged source-code map (
mix sentry.package_source_code)
What happens
Sentry.Sources.handle_continue(:load_source_code_map, state) decodes the whole map (:erlang.binary_to_term/1 on the packaged file), inserts each entry into the :sentry_source_code_map ETS table and returns {:noreply, state}. The process then receives no further messages, so it never triggers a garbage collection. The decoded term, which ETS has already copied, stays on the process heap for the life of the node.
On a ~6,400-module app this was about 57 MB per node, on top of the ~54 MB the ETS table needs:
pid = Process.whereis(Sentry.Sources)
Process.info(pid, :total_heap_size) # ~7.1M words ≈ 57 MB
:erlang.garbage_collect(pid)
Process.info(pid, :total_heap_size) # near zero
This matters on small machines: on a 1 GB container, this one process held ~6% of RAM for nothing.
Suggested fix
Shrink the heap once the load is done, for example:
{:noreply, state, :hibernate}
or an explicit :erlang.garbage_collect() before returning from handle_continue/2. :hibernate is enough because the process is idle afterwards. Decoding the map outside the GenServer (in a short-lived task) would also avoid it.
Workaround
After the application starts, we wait for the load to finish with :sys.get_state(Sentry.Sources) and then call :erlang.garbage_collect/1 on the process.
- 主要言語
- Elixir
- スター
- 692
- フォーク
- 219
- 平均マージ
- 2日 19時間
- マージ済み PR(30日)
- 16
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
getsentry/sentry-elixir のほかの issue
-
Add a prebuilt Elixir runtime metrics dashboard対応中かも @sl0thentr0py が 10 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
getsentry/sentry-elixir#1233 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 10/100
getsentry/sentry-elixir#1232 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
traces_sampler example doesn't match the actual context provided再び着手できるかも @solnic が 351 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンBug Elixir Traces Waiting for: Product Owner
getsentry/sentry-elixir#945 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
Better oban error grouping再び着手できるかも @solnic が 452 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンElixir Errors Improvement
getsentry/sentry-elixir#936 · コメント 1 件 · リアクション 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
Custom fingerprint added to GenServer call crashes by client再び着手できるかも @solnic が 459 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンBug Elixir Errors
getsentry/sentry-elixir#933 · コメント 3 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
getsentry/sentry-elixir の issue をすべて見る
似ている issue
-
[Bug]: PostgreSQL backend: Queue.remove() / Job.remove() never emit the QueueEvents "removed" event対応中かも @1AbdullahButt が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
taskforcesh/bullmq#5085 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
liveshowy/webauthn_components#118 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
intellij-elixir/intellij-elixir#4645 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
ash-project/ash_typescript#114 ·