Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Frequently hitting 'unreachable' errors with many source maps in memory

オープン
#476 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
30/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, rust, wasm
領域
tooling

調査の方向性

lib/source-map-consumer.js の BasicSourceMapConsumer._parseMappings、_getMappingsPtr、originalPositionFor 付近から始め、続いて lib/wasm.js と報告された WebAssembly の失敗経路を調べます。多数の SourceMapConsumers を使ってワークロードを再現し、割り当て失敗によって unreachable エラーが発生するか確認します。呼び出し側がこのメモリ状態を識別し、キャッシュされたデータを破棄して回復できれば完了です。

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

説明

I'm operating a service which sourcemaps JavaScript Self-Profiling data from production. We have several versions of our app running concurrently, with different source maps. The service keeps an LRU cache of SourceMapConsumers with a size limit roughly calculated from smc._mappings.length. This lets us keep around 100 SourceMapConsumers active at a time before running into the WebAssembly memory limit.

However, we often see unreachable errors like the following:

RuntimeError: unreachable
     at wasm://wasm/0002f63a:wasm-function[54]:0xb65c
     at wasm://wasm/0002f63a:wasm-function[22]:0x9647
     at BasicSourceMapConsumer._parseMappings (/work/node_modules/source-map/lib/source-map-consumer.js:306:47)
     at BasicSourceMapConsumer._getMappingsPtr (/work/node_modules/source-map/lib/source-map-consumer.js:289:12)
     at /work/node_modules/source-map/lib/source-map-consumer.js:500:16
     at Object.withMappingCallback (/work/node_modules/source-map/lib/wasm.js:125:13)
     at BasicSourceMapConsumer.originalPositionFor (/work/node_modules/source-map/lib/source-map-consumer.js:496:16)
     at file:///work/dist/mapTrace.js:44:34
     at file:///work/dist/mapTrace.js:53:11
     at Array.map (<anonymous>)

I believe this indicates an out-of-memory error, where source-map's rust code tries to allocate something but can't.

Could it be possible to gracefully recover from this? I believe Rust doesn't really support graceful recovery from OOM, but perhaps source-map could check whether there's enough memory available to allocate for a SourceMapConsumer before allocating, and throw some other kind of error? That would allow using that signal to drop some old data from our cache.

主要言語
JavaScript
スター
3.7k
フォーク
370
PR マージ指標
30日以内にマージされた PR はありません

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

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

はじめの一歩

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

mozilla/source-map のほかの issue

mozilla/source-map の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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