Snapshot.load("").warmup! aborts the process (Check failed: !artifacts)

已關閉 適合新手
#449 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, ruby

研究方向

從 ext/mini_racer_extension/mini_racer_v8.cc:946 中的 snapshot() 著手,並將其對空 blob 的處理方式與第 451 行的 v8_thread_init 比較。使用 issue 中的 Ruby 程式碼片段重現,並檢查現有的 snapshot 測試是否涵蓋 warmup。當已載入的空 snapshot 能在不 abort 的情況下完成預熱,或引發 MiniRacer::SnapshotError,且回報中的 Context.new 行為仍然有效時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

Calling warmup! on an empty loaded snapshot aborts inside V8. Using the same empty snapshot with Context.new works and evaluates 1+1 to 2.

Reproduce
require "mini_racer"

MiniRacer::Snapshot.load("").warmup!("1")
puts "not reached"
What happens
#
# Fatal error in , line 0
# Check failed: !artifacts.

Exit status 133 (SIGTRAP), followed by a native backtrace through v8_thread_main.

Expected

The warmup should run from V8's built-in snapshot, as Context.new does for an empty blob, or raise MiniRacer::SnapshotError.

Cause

snapshot() passes the blob to v8::SnapshotCreator for every warmup, including when its size is zero (existing_blob = is_warmup ? &blob : nullptr at ext/mini_racer_extension/mini_racer_v8.cc:946). In contrast, v8_thread_init sets params.snapshot_blob only for a non-empty blob (ext/mini_racer_extension/mini_racer_v8.cc:451). Passing nullptr for an empty warmup blob would match the Context.new behavior. This change has not been tested.

Environment
  • mini_racer 0.22.1 with libv8-node 24.12.0.1 (V8 13.6.233.17-node.37)
  • Ruby 3.4.2 x86_64-linux
  • Fedora 44

Reproduced in 3 of 3 runs.

主要語言
JavaScript
星號
628
分支
100
平均合併
1 天 20 小時
30 天內合併 PR
2

環境準備

  • 提供 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 沒有貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

rubyjs/mini_racer 的其他 Issue

查看 rubyjs/mini_racer 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。