mini_racer_rs 1.4.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5fa48ce83f4ac181230edd5df5a490007698ead30ba777abd6d9ab5c0816cdeb
4
- data.tar.gz: a397d43582531e16d1b0f21b4eeee1026ee261e01af57f62f6019894ded53c0a
3
+ metadata.gz: 34e3c7be1437cb48571d429539787241ee6056f1157f2ee4946caf3a08e0d41a
4
+ data.tar.gz: 4cb4111cfa8670145d793a55099a04f101f494af4732d0fa840da9599308a0c5
5
5
  SHA512:
6
- metadata.gz: 1faa024992d863cd72c866cdc7b23db3608a2c0c1b19f31cb1cc9d9a4cf71ead36ea55507b1de8e2613e341202a027b0eb14fa7cf8e09e0b7f433c6d93b14521
7
- data.tar.gz: 46134cb7a25b3c4e2aab913d0b6faafd84a7042d61c01ae092b01a4206ef09e8b59056c881788d3e5e03996fc12260f30dc69e7899076c2223cdde03a5613f5d
6
+ metadata.gz: 8bd82f6313e99898bf053818a937e6089b409e662c5f304f1191df3ae90d11cfd99ee84861ec5bc9a651599c1a02fa2d778e4726fa543cb38306364517d9ac77
7
+ data.tar.gz: 0455a6d7c65f98d44fb079af4de1894547cfe942116a3407513da5810935e08a3ddf62673e605ee15e371b2cf71b84c0602b38559d51a831f356eff93fb2db38
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.5.1](https://github.com/andymai/mini_racer_rs/compare/v1.5.0...v1.5.1) (2026-10-23)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * free disposed context memory before timeout is due ([#141](https://github.com/andymai/mini_racer_rs/issues/141)) ([1b8fd96](https://github.com/andymai/mini_racer_rs/commit/1b8fd96057d09ebb4a7e4b30eaa71c0d436c5694))
9
+ * free snapshot blob bytes after contexts are gone ([#142](https://github.com/andymai/mini_racer_rs/issues/142)) ([72f4a2d](https://github.com/andymai/mini_racer_rs/commit/72f4a2d5aa287e065ffa9a1402a5255a5ea7db99))
10
+
11
+ ## [1.5.0](https://github.com/andymai/mini_racer_rs/compare/v1.4.0...v1.5.0) (2026-10-23)
12
+
13
+
14
+ ### Features
15
+
16
+ * target mini_racer 0.22.2 ([#137](https://github.com/andymai/mini_racer_rs/issues/137)) ([586475f](https://github.com/andymai/mini_racer_rs/commit/586475f231473ade936f69eb7344e9d5619fa045))
17
+
3
18
  ## [1.4.0](https://github.com/andymai/mini_racer_rs/compare/v1.3.0...v1.4.0) (2026-10-23)
4
19
 
5
20
 
data/COMPATIBILITY.md CHANGED
@@ -1,10 +1,10 @@
1
- # Compatibility with mini_racer 0.22.1
1
+ # Compatibility with mini_racer 0.22.2
2
2
 
3
3
  <!-- Generated by `rake compat:render` from compat.toml and compat/surface.json; do not edit. -->
4
4
 
5
5
  | Engine | Done | Planned | Deviation |
6
6
  |---|---|---|---|
7
- | CRuby | 54 | 0 | 28 |
7
+ | CRuby | 54 | 0 | 26 |
8
8
  | TruffleRuby | 58 | 0 | 0 |
9
9
 
10
10
  ## Surface
@@ -113,168 +113,156 @@ What mini_racer_rs adds under `MiniRacerRs`. An internal id is not for callers.
113
113
 
114
114
  ### `behavior:bigint-objects@ruby`
115
115
 
116
- mini_racer_rs returns a BigInt wrapper object's wrapped value as an Integer: `Object(1n)` returns `1`, and `[Object(-5n)]` returns `[-5]`. mini_racer 0.22.1 instead raises `MiniRacer::RuntimeError` with the message `bad tag: z`. Returning the primitive value makes BigInt wrappers consistent with Boolean, Number, and String wrapper objects, which both gems already return as their primitive values.
116
+ mini_racer_rs returns a BigInt wrapper object's wrapped value as an Integer: `Object(1n)` returns `1`, and `[Object(-5n)]` returns `[-5]`. mini_racer 0.22.2 instead raises `MiniRacer::RuntimeError` with the message `bad tag: z`. Returning the primitive value makes BigInt wrappers consistent with Boolean, Number, and String wrapper objects, which both gems already return as their primitive values.
117
117
 
118
118
  Approved 2026-10-16.
119
119
 
120
120
  ### `behavior:callback-error-text@ruby`
121
121
 
122
- When an attached Ruby callback raises, JavaScript receives an `Error` whose message is the exception’s `to_s`. mini_racer_rs gives V8 that text using the same rules as `eval` source: ISO-8859-1 as Latin-1, UTF-16LE as two-byte text, and other encodings as UTF-8, with invalid sequences replaced by U+FFFD. mini_racer 0.22.1 treats the string’s bytes as Latin-1 regardless of encoding. With `t` raising `"café"`, `try { t() } catch (e) { e.message }` returns `"café"` from mini_racer_rs and `"café"` from mini_racer 0.22.1. UTF-16LE produces a NUL after each letter in mini_racer. ASCII messages match. If JavaScript does not catch the exception, both gems raise the original Ruby exception from `eval` or `call` with its message unchanged.
122
+ When an attached Ruby callback raises, JavaScript receives an `Error` whose message is the exception’s `to_s`. mini_racer_rs gives V8 that text using the same rules as `eval` source: ISO-8859-1 as Latin-1, UTF-16LE as two-byte text, and other encodings as UTF-8, with invalid sequences replaced by U+FFFD. mini_racer 0.22.2 treats the string’s bytes as Latin-1 regardless of encoding. With `t` raising `"café"`, `try { t() } catch (e) { e.message }` returns `"café"` from mini_racer_rs and `"café"` from mini_racer 0.22.2. UTF-16LE produces a NUL after each letter in mini_racer. ASCII messages match. If JavaScript does not catch the exception, both gems raise the original Ruby exception from `eval` or `call` with its message unchanged.
123
123
 
124
124
  Approved 2026-10-16.
125
125
 
126
126
  ### `behavior:callback-jump@ruby`
127
127
 
128
- mini_racer_rs terminates the script with `Error: terminated` when a callback attached with `Context#attach` leaves by `throw`, by `return` out of a proc whose method is still running, or by `Thread#kill`. The jump continues after `Context#eval` or `Context#call` returns, and the context stays usable. For example, `catch(:out) { context.eval("thrower(); 'not reached'") }` returns `5` when `thrower` executes `throw :out, 5`. With mini_racer 0.22.1, that `throw` never returns, and neither does `proc { return :x }` when called from the method that created it. The process hangs until killed. A callback calling `Thread.current.kill` instead makes `eval` raise `TypeError` with `exception class/object expected`, without killing the thread. In mini_racer_rs, the thread ends. `break` out of a proc raises `LocalJumpError` in both gems.
128
+ mini_racer_rs terminates JavaScript with `Error: terminated` when a callable attached with `Context#attach` exits by `throw`, by `return` from a proc whose method is still running, or by `Thread#kill`. A `throw` or `return` continues after `Context#eval` or `Context#call` returns, and the context remains usable. For example, `catch(:out) { context.eval("thrower(); 'not reached'") }` returns `5` when `thrower` executes `throw :out, 5`, and `proc { return :x }` returns `:x` from its method. After `Thread.current.kill`, the script and thread end. In mini_racer 0.22.2, a callback `throw`, whether JavaScript catches it, leaves it uncaught, or it comes from `Context#call`, and `proc { return }` crash the process with `[BUG] Segmentation fault` and status 139. `Thread.current.kill` instead gives JavaScript a catchable `Error: Ruby exception`; the script continues, and the thread ends after `eval` returns. `break` from a proc raises `LocalJumpError` in both gems.
129
129
 
130
- Approved 2026-10-16.
130
+ Approved 2026-10-23.
131
131
 
132
132
  ### `behavior:callback-reentry@ruby`
133
133
 
134
- Both gems allow an attached callback to call `eval`, `call`, or `attach` on its own context, running the nested call inside the script that invoked the callback. mini_racer_rs accepts the call only from the fiber running the callback. A call from another fiber on the same thread, such as code inside `Enumerator#next`, raises `ThreadError` (`deadlock; lock already owned by another fiber belonging to the same thread`). mini_racer 0.22.1 accepts it: `Enumerator.new { |y| y << context.eval("1") }.next` inside a callback returns `1`. A signal trap that calls the context while a callback waits on a nested `eval` gets `ThreadError` in mini_racer_rs; when rescued, the script completes. With mini_racer 0.22.1, the same program hangs until killed. mini_racer_rs refuses these calls because each nested call must finish before its callback replies, preventing out-of-order replies from being paired with the wrong callback.
134
+ Both gems allow an attached callback to call `eval`, `call`, or `attach` on its own context, running the nested call inside the script that invoked the callback. mini_racer_rs accepts the call only from the fiber running the callback. A call from another fiber on the same thread, such as code inside `Enumerator#next`, raises `ThreadError` (`deadlock; lock already owned by another fiber belonging to the same thread`). mini_racer 0.22.2 accepts it: `Enumerator.new { |y| y << context.eval("1") }.next` inside a callback returns `1`. A signal trap that calls the context while a callback waits on a nested `eval` gets `ThreadError` in mini_racer_rs; when rescued, the script completes. With mini_racer 0.22.2, the same program hangs until killed. mini_racer_rs refuses these calls because each nested call must finish before its callback replies, preventing out-of-order replies from being paired with the wrong callback.
135
135
 
136
136
  Approved 2026-10-16.
137
137
 
138
138
  ### `behavior:dispose-in-flight@ruby`
139
139
 
140
- `MiniRacer::Context#dispose` in mini_racer_rs returns only after the runner has finished any eval or call in flight and dropped the isolate, on both platforms, so the isolate and its memory cannot outlive disposal. On mini_racer 0.22.1’s default platform, `dispose` returns once the context’s V8 thread has taken the eval or call in flight, and that thread finishes the work and frees the isolate afterward (`context_dispose_do` in `mini_racer_extension.c`). With `:single_threaded`, mini_racer joins the runner and waits. When `dispose` was called 10 ms into serialization of a 64 MiB snapshot string, default mini_racer returned at 10 ms and mini_racer_rs at about 60 ms, after serialization finished. With `:single_threaded`, they returned at 85 ms and 62 ms, respectively. For busy loops, both returned within milliseconds. The in-flight operation always raises `MiniRacer::ContextDisposedError` in mini_racer_rs. mini_racer 0.22.1 usually raises that class, but raised `MiniRacer::ScriptTerminatedError` in 2 of 12 busy-loop runs; its test accepts either class.
140
+ `MiniRacer::Context#dispose` in mini_racer_rs returns only after the runner finishes any eval or call in flight and drops the isolate, in both platform modes, so the isolate and its memory cannot outlive disposal. On mini_racer 0.22.2's default platform, `dispose` returns once the context's V8 thread takes the work in flight, then that thread finishes it and frees the isolate. This is the behavior of `context_dispose_do` in `mini_racer_extension.c`, unchanged from 0.22.1. With `:single_threaded`, mini_racer joins the runner and waits. When disposal began 10 ms into an eval returning a 64 MiB string, mini_racer 0.22.2 returned at once on the default platform and after 64 to 73 ms with `:single_threaded`, across 5 runs each. mini_racer_rs returned after 46 to 54 ms and 45 to 50 ms. For busy loops, the in-flight eval raised `MiniRacer::ContextDisposedError` in 12 of 12 runs in both gems and both modes. mini_racer_rs's disposal took 0.2 to 0.4 ms.
141
141
 
142
- Approved 2026-10-16.
142
+ Approved 2026-10-23.
143
143
 
144
144
  ### `behavior:fast-calls@ruby`
145
145
 
146
- Unlike mini_racer 0.22.1, which compiles every source, mini_racer_rs recognizes ExecJS 2.10.2 `call` sources and react-rails 3.2.1 and 3.3.1 server render sources evaluated without a file name, then runs a template compiled once by the context. The template remains a top-level script and replaces each JSON literal with a native function call stored in a randomly named global `const`; V8's JSON parser reads the values. Results, error classes and messages, `this`, and stack frame line and column numbers remain those of the source. The approved `behavior:fast-calls@ruby` deviation is limited to V8 stack reflection: `CallSite#getScriptHash` reports the template hash, and render `CallSite#getPosition` can report a different raw offset after hoisted literals, such as 260 instead of 185. A reflected render wrapper shows template reads instead of literals, and invoking it again receives no values outside a fast call or the current call's values during one, while mini_racer supplies the literals each time. Heap snapshots expose the hidden `const`. Set `MINI_RACER_RS_FAST_CALLS` to `off` before the first context is created to send every eval down the normal path.
146
+ Unlike mini_racer 0.22.2, which compiles every source, mini_racer_rs recognizes ExecJS 2.10.2 `call` sources and react-rails 3.2.1 and 3.3.1 server render sources evaluated without a file name, then runs a template compiled once by the context. The template remains a top-level script and replaces each JSON literal with a native function call stored in a randomly named global `const`; V8's JSON parser reads the values. Results, error classes and messages, `this`, and stack frame line and column numbers remain those of the source. The approved `behavior:fast-calls@ruby` deviation is limited to V8 stack reflection: `CallSite#getScriptHash` reports the template hash, and render `CallSite#getPosition` can report a different raw offset after hoisted literals, such as 260 instead of 185. A reflected render wrapper shows template reads instead of literals, and invoking it again receives no values outside a fast call or the current call's values during one, while mini_racer supplies the literals each time. Heap snapshots expose the hidden `const`. Set `MINI_RACER_RS_FAST_CALLS` to `off` before the first context is created to send every eval down the normal path.
147
147
 
148
148
  Approved 2026-10-18.
149
149
 
150
150
  ### `behavior:fiber-scheduler@ruby`
151
151
 
152
- mini_racer_rs parks only a non-blocking fiber waiting for a context under a fiber scheduler, so the thread's other fibers keep running during `Context.new`, `eval`, `call`, `attach`, `dispose`, and nested callback calls. mini_racer 0.22.1 releases the GVL and blocks the whole thread until JavaScript returns. Three 100 ms busy loops in separate contexts and fibers inside `Sync` finish in 100 ms with mini_racer_rs, with a 10 ms ticker ticking 9 times; mini_racer takes 300 ms, with 3 ticks. With mini_racer_rs, `task.with_timeout(0.05) { context.call("busy", 300) }` raises `Async::TimeoutError` after 50 ms and terminates JavaScript; mini_racer returns `300` after 300 ms. In both gems the context stays usable afterward. Fibers sharing a context take turns in both gems. Without a scheduler or in a blocking fiber, mini_racer_rs blocks the thread while waiting, as mini_racer does. `Snapshot.new` also blocks the thread.
152
+ mini_racer_rs parks only a non-blocking fiber waiting for a context under a fiber scheduler, so the thread's other fibers keep running during `Context.new`, `eval`, `call`, `attach`, `dispose`, and nested callback calls. mini_racer 0.22.2 releases the GVL and blocks the whole thread until JavaScript returns. Three 100 ms busy loops in separate contexts and fibers inside `Sync` finish in 100 ms with mini_racer_rs, with a 10 ms ticker ticking 9 times; mini_racer takes 300 ms, with 3 ticks. With mini_racer_rs, `task.with_timeout(0.05) { context.call("busy", 300) }` raises `Async::TimeoutError` after 50 ms and terminates JavaScript; mini_racer returns `300` after 300 ms. In both gems the context stays usable afterward. Fibers sharing a context take turns in both gems. Without a scheduler or in a blocking fiber, mini_racer_rs blocks the thread while waiting, as mini_racer does. `Snapshot.new` also blocks the thread.
153
153
 
154
154
  Approved 2026-10-16.
155
155
 
156
156
  ### `behavior:fork-from-callback@ruby`
157
157
 
158
- With an attached callback that calls `fork` under the `:single_threaded` platform flag, the parent's `eval` returns `"parent"` in both gems, and its later `context.eval("1 + 1")` returns `2`. mini_racer 0.22.1's child is still running five seconds later, when the test kills it. In mini_racer_rs's child, the `eval` that invokes the callback raises `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy` when the callback returns, because the JavaScript thread stays with the parent. A call on the same context from inside the child callback, and every later call, raises the same error. A new child context works: `MiniRacer::Context.new.eval("6 * 7")` returns `42`.
158
+ With an attached callback that calls `fork` under the `:single_threaded` platform flag, the parent's `eval` returns `"parent"` in both gems, and its later `context.eval("1 + 1")` returns `2`. mini_racer 0.22.2's child is still running five seconds later, when the test kills it. In mini_racer_rs's child, the `eval` that invokes the callback raises `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy` when the callback returns, because the JavaScript thread stays with the parent. A call on the same context from inside the child callback, and every later call, raises the same error. A new child context works: `MiniRacer::Context.new.eval("6 * 7")` returns `42`.
159
159
 
160
160
  Approved 2026-10-16.
161
161
 
162
162
  ### `behavior:fork-quiesce-bound@ruby`
163
163
 
164
- With the `:single_threaded` platform flag, mini_racer_rs waits up to 500 ms inside Ruby's `fork` or `Process.daemon` for every context's runner to become idle or parked. If another thread runs an operation V8 does not interrupt, such as `JSON.parse` of a large string, the child refuses every inherited context: calling an idle one raises `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy`. New contexts created in the child work. mini_racer 0.22.1 does not wait for its runners. With `JSON.parse` of a 3,000,000-element array's JSON, its fork took 15 ms and its child's idle context returned `42`; mini_racer_rs took 523 ms and refused that context.
164
+ With `:single_threaded`, mini_racer_rs waits up to 500 ms inside Ruby's `fork` or `Process.daemon` for every context runner to become idle or parked. If another thread is running an operation V8 does not interrupt, such as `JSON.parse` on a large string, the child refuses every inherited context. Calling an idle inherited context raises `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy`; new contexts created in the child work. mini_racer 0.22.2 does not wait for its runners. With another thread parsing the JSON for a 3,000,000-element array, mini_racer 0.22.2 forked in 3 ms and its child's idle context returned `42`. mini_racer_rs forked in 523 ms and refused that inherited context.
165
165
 
166
- Approved 2026-10-16.
166
+ Approved 2026-10-23.
167
167
 
168
168
  ### `behavior:fork-wait@ruby`
169
169
 
170
- For forks made through Ruby's `fork`, `IO.popen("-")` or `Process.daemon`, mini_racer_rs waits for context runners, pauses its worker pool and waits for running worker tasks in both modes; mini_racer 0.22.1 waits for neither. Idle pool threads wait on a Rust standard library condition variable that keeps no records on their stacks, so a child does not inherit records that refer to discarded stacks. mini_racer 0.22.1 creates its `:single_threaded` platform with `NewSingleThreadedDefaultPlatform`, which has no V8 worker threads. mini_racer_rs creates V8's platform with one worker thread, which never receives a task, and routes worker tasks to a process-owned pool with one thread under `:single_threaded`. On Ubuntu 24.04 with glibc 2.39, 20 of 20 mini_racer children aborted with signal 6 after loading and rendering React, whether or not two parent threads kept rendering. With mini_racer_rs, 20 of 20 children exited cleanly in both cases. On Fedora, mini_racer children hung within the first 50 forks in `test/stress/fork_busy.rb`; mini_racer_rs completed 300 forks per run on Fedora and Ubuntu. On one Fedora machine, with four threads evaluating and 50 forks per run, fork latency was 0.90 to 0.94 ms at the median across three runs, versus 0.73 to 0.78 ms with mini_racer 0.22.1. The waits are best effort: the fork proceeds after the 500 ms runner bound or the following 100 ms worker bound expires.
170
+ For Ruby `fork`, `IO.popen("-")`, and `Process.daemon`, mini_racer_rs waits for context runners, pauses its worker pool, and waits for running worker tasks in both platform modes. mini_racer 0.22.2 waits for neither; its fork handling is unchanged from 0.22.1. Idle mini_racer_rs pool threads wait on a Rust standard library condition variable that keeps no records on their stacks, so children inherit no records referring to discarded stacks. mini_racer creates `:single_threaded` with `NewSingleThreadedDefaultPlatform`, which has no V8 worker threads. mini_racer_rs creates V8's platform with one worker thread that never receives a task and routes worker tasks to a process-owned pool with one thread under `:single_threaded`. On Ubuntu 24.04 with glibc 2.39, with mini_racer 0.22.1, 20 of 20 children aborted with signal 6 after loading and rendering React, both with and without two parent threads continuing to render. That code is unchanged in mini_racer 0.22.2. mini_racer_rs exited cleanly in 20 of 20 children in both cases. On Fedora, three runs of `test/stress/fork_busy.rb`, each attempting 300 forks while four threads evaluated, aborted with mini_racer 0.22.2 after 5, 14, and 19 forks when an evaluating parent thread raised `TypeError` with `exception class/object expected`. mini_racer_rs completed all 300 forks per run. With four evaluating threads and 50 forks per run, median fork time across three runs was 5.17 to 5.60 ms for mini_racer_rs and 5.22 to 5.47 ms for mini_racer 0.22.2. The waits are best effort: forking proceeds after the 500 ms runner bound or the following 100 ms worker bound expires.
171
171
 
172
- Approved 2026-10-17.
172
+ Approved 2026-10-23.
173
173
 
174
174
  ### `behavior:invalid-snapshot@ruby`
175
175
 
176
- mini_racer_rs raises `MiniRacer::SnapshotError` instead of letting V8 terminate the process. `Snapshot.load` rejects a blob that is too short for its header, was made by another V8 version, or is truncated. `Context.new(snapshot:)` and `#warmup!` reject the same corruption if the String returned by `dump` has since been changed, and `#warmup!` rejects an empty snapshot. The messages are `invalid snapshot: truncated or corrupt`, `invalid snapshot: not made by V8 <version>`, and `invalid snapshot: empty`. Context option errors still raise first. mini_racer 0.22.1 accepts any String, then dies with a V8 fatal error (SIGTRAP), or with SIGSEGV when the blob is cut short in its last section. As in mini_racer, an empty blob starts a context without a snapshot, trailing bytes are accepted, and damaged payload bytes that V8 can read are accepted. Damage to a section's 8-byte header is rejected.
176
+ `Snapshot.load` checks blobs in the same order in both gems and raises `MiniRacer::SnapshotError` with the same messages for a blob that is too short, an invalid context table, version mismatch, invalid header, no contexts, invalid read-only, shared heap or context offsets, and `snapshot checksum mismatch`. The checksum makes both reject truncation, flipped bytes, and trailing bytes. Damage under a recomputed checksum loads in both when V8 can read it. With a valid checksum, mini_racer 0.22.2 aborts with SIGTRAP when a context is made from a blob whose section magic number is not exactly V8's, while mini_racer_rs raises `SnapshotError` with `snapshot startup section is invalid` or the matching section message. mini_racer 0.22.2 also lets V8 read past a section when its recorded payload overruns it, and aborts when a payload length exceeds 2,147,483,647. mini_racer_rs raises `SnapshotError` in both cases. A blob cut in half can name a different section, because the two V8 versions' blobs place their sections at different offsets. An empty blob starts a context without a snapshot in both gems.
177
177
 
178
- Approved 2026-10-18.
178
+ Approved 2026-10-23.
179
179
 
180
180
  ### `behavior:multi-threaded-fork@ruby`
181
181
 
182
- In a child forked from a process using V8's default multi-threaded platform, mini_racer 0.22.1 hangs when an inherited context runs `context.eval("1 + 1")`; the observed child was still waiting after 3 seconds. mini_racer_rs instead raises `MiniRacer::RuntimeError` at once with `single-threaded runner: Device or resource busy`, while the parent's contexts remain unaffected. The child inherits none of the context runner or V8 worker threads. A new `MiniRacer::Context` in the child can evaluate `eval("2")` to `2` and runs V8 worker work on the child's own pool. An async `WebAssembly.compile` in a new context completes. With mini_racer 0.22.1, the same case hung in 2 of 2 runs on Fedora; on Ubuntu 24.04, it aborted with signal 6 in 2 of 3 runs and hung in 1 of 3. Contexts intended to keep working in a child should use `:single_threaded`.
182
+ In a child forked from a process using V8's default multi-threaded platform, an inherited mini_racer 0.22.2 context hangs on `context.eval("1 + 1")`; the child was still waiting after 3 seconds. mini_racer_rs instead immediately raises `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy`, and the parent's contexts remain unaffected. The child inherits none of the context runner or V8 worker threads. A new `MiniRacer::Context` in the mini_racer_rs child evaluates `eval("2")` to `2` and runs V8 worker work on the child's own pool, so an asynchronous `WebAssembly.compile` completes. With mini_racer 0.22.2 on Fedora, that compile was still waiting after 5 seconds. On Ubuntu 24.04, mini_racer 0.22.1 aborted with signal 6 in 2 of 3 runs and hung in 1 of 3; its fork handling is unchanged in 0.22.2. Contexts intended to keep working in a child should use `:single_threaded`.
183
183
 
184
- Approved 2026-10-16.
184
+ Approved 2026-10-23.
185
185
 
186
186
  ### `behavior:native-fork@ruby`
187
187
 
188
- With the `:single_threaded` platform flag, mini_racer_rs refuses every context inherited by a child of a fork that bypasses Ruby's `fork`, including idle contexts: calls raise `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy`. In a libc `fork()` test through Fiddle, mini_racer 0.22.1's child returned `42` from an inherited idle context holding `var answer = 42`, while mini_racer_rs raised that error. In both gems, new child contexts and the parent's context work. Calling `dispose` on an inherited child context returns `nil`, after which calls raise `MiniRacer::ContextDisposedError`. mini_racer_rs cannot rule out an in-progress V8 state change without the runner wait used by Ruby's `fork`, `IO.popen("-")`, and `Process.daemon`.
188
+ With the `:single_threaded` platform flag, mini_racer_rs refuses every context inherited by a child of a fork that bypasses Ruby's `fork`, including idle contexts: calls raise `MiniRacer::RuntimeError` with `single-threaded runner: Device or resource busy`. In a libc `fork()` test through Fiddle, mini_racer 0.22.2's child returned `42` from an inherited idle context holding `var answer = 42`, while mini_racer_rs raised that error. In both gems, new child contexts and the parent's context work. Calling `dispose` on an inherited child context returns `nil`, after which calls raise `MiniRacer::ContextDisposedError`. mini_racer_rs cannot rule out an in-progress V8 state change without the runner wait used by Ruby's `fork`, `IO.popen("-")`, and `Process.daemon`.
189
189
 
190
190
  Approved 2026-10-16.
191
191
 
192
192
  ### `behavior:object-ids@ruby`
193
193
 
194
- mini_racer_rs preserves repeated-object identity in both directions by numbering every object as V8 does, including dates, regular expressions, typed arrays, ArrayBuffers, wrapper objects, and errors. Serialized repeats refer back by number. From JavaScript to Ruby, `(() => { const d = new Date(0); const o = {}; return [d, d, o, o] })()` returns `[Time, Time, {}, {}]`, with each pair the same Ruby object. mini_racer 0.22.1 counts only decoded arrays, objects, maps, sets, and errors, so it returns `[Time, nil, {}, nil]`; a repeated error, including one that is its own cause, becomes `[]` instead of the same `MiniRacer::ScriptError`. From Ruby to JavaScript, mini_racer 0.22.1 counts only Arrays and Hashes, so `context.call("f", time, hash, hash)` gives `f` a Date, an object, and the same Date. mini_racer_rs gives `f` the same object twice. For call arguments and callback results, it also sends a repeated `Time`, `DateTime`, object whose `to_time` returns a `Time`, or `MiniRacer::Binary` as one Date or Uint8Array, calling `to_time` once per object. Thus, with `same = (a, b) => a === b`, `context.call("same", time, time)` returns `true`, while mini_racer returns `false`; distinct equal `Time` objects remain distinct in both.
194
+ mini_racer_rs preserves repeated-object identity in both directions by numbering every object as V8 does, including dates, regular expressions, typed arrays, ArrayBuffers, wrapper objects, and errors. Serialized repeats refer back by number. From JavaScript to Ruby, `(() => { const d = new Date(0); const o = {}; return [d, d, o, o] })()` returns `[Time, Time, {}, {}]`, with each pair the same Ruby object. mini_racer 0.22.2 counts only decoded arrays, objects, maps, sets, and errors, so it returns `[Time, nil, {}, nil]`; a repeated error, including one that is its own cause, becomes `[]` instead of the same `MiniRacer::ScriptError`. From Ruby to JavaScript, mini_racer 0.22.2 counts only Arrays and Hashes, so `context.call("f", time, hash, hash)` gives `f` a Date, an object, and the same Date. mini_racer_rs gives `f` the same object twice. For call arguments and callback results, it also sends a repeated `Time`, `DateTime`, object whose `to_time` returns a `Time`, or `MiniRacer::Binary` as one Date or Uint8Array, calling `to_time` once per object. Thus, with `same = (a, b) => a === b`, `context.call("same", time, time)` returns `true`, while mini_racer returns `false`; distinct equal `Time` objects remain distinct in both.
195
195
 
196
196
  Approved 2026-10-16.
197
197
 
198
198
  ### `behavior:padded-two-byte-text@ruby`
199
199
 
200
- mini_racer_rs returns a regular expression as its pattern String and a String object as its String, including `[1, new RegExp('東')]`, `new RegExp('東')`, and `[new String('東')]` as `[1, "東"]`, `"東"`, and `["東"]`. It skips V8's optional alignment byte before two-byte text, as V8's own deserializer does. mini_racer 0.22.1 does not accept that byte and raises `MiniRacer::RuntimeError` with `bad regexp` or `bad string object` for these examples, although `({ab: new RegExp('東')})` returns `{"ab" => "東"}` because its serialized position requires no alignment byte.
200
+ mini_racer_rs returns a regular expression as its pattern String and a String object as its String, including `[1, new RegExp('東')]`, `new RegExp('東')`, and `[new String('東')]` as `[1, "東"]`, `"東"`, and `["東"]`. It skips V8's optional alignment byte before two-byte text, as V8's own deserializer does. mini_racer 0.22.2 does not accept that byte and raises `MiniRacer::RuntimeError` with `bad regexp` or `bad string object` for these examples, although `({ab: new RegExp('東')})` returns `{"ab" => "東"}` because its serialized position requires no alignment byte.
201
201
 
202
202
  Approved 2026-10-16.
203
203
 
204
204
  ### `behavior:platforms@ruby`
205
205
 
206
- mini_racer_rs ships native gems for the platforms libv8-node publishes gems for, which mini_racer 0.22.1 uses: glibc and musl Linux on x86_64 and aarch64, and macOS on x86_64 and arm64. Neither supports Windows. On any other platform, mini_racer_rs's source gem stops installation with a message naming the supported platforms, while mini_racer can install libv8-node's source gem.
206
+ mini_racer_rs ships native gems for the platforms libv8-node publishes gems for, which mini_racer 0.22.2 uses: glibc and musl Linux on x86_64 and aarch64, and macOS on x86_64 and arm64. Neither supports Windows. On any other platform, mini_racer_rs's source gem stops installation with a message naming the supported platforms, while mini_racer can install libv8-node's source gem.
207
207
 
208
208
  Approved 2026-10-22.
209
209
 
210
210
  ### `behavior:shared-source-heap-stats@ruby`
211
211
 
212
- `Context#heap_stats` reports shared sources differently from mini_racer 0.22.1: when a context evaluates a source of 1 MiB or more, mini_racer_rs includes it in `:external_memory` and excludes it from `:used_heap_size`. mini_racer_rs gives V8 one copy held outside V8's heap, shared starting with the first evaluation by every context using the same source, file name, and startup snapshot. The process shares at most 8 such sources and 256 MiB of them. Past that bound, a context evaluating another large source keeps its own copy, and its `heap_stats` count that source as mini_racer's do. V8 counts shared sources in `:external_memory` by character length, so two-byte text reports half its bytes. mini_racer 0.22.1 reports `:external_memory` as 0 and counts each context's own copy in `:used_heap_size`. JavaScript sees the same source text in both gems. Contexts created with `max_memory:` and sources that are not valid UTF-8 keep their own copies. Setting `MINI_RACER_RS_CODE_CACHE=off` before the first context prevents source sharing and makes `heap_stats` count every source as mini_racer does.
212
+ `Context#heap_stats` reports shared sources differently from mini_racer 0.22.2: when a context evaluates a source of 1 MiB or more, mini_racer_rs includes it in `:external_memory` and excludes it from `:used_heap_size`. mini_racer_rs gives V8 one copy held outside V8's heap, shared starting with the first evaluation by every context using the same source, file name, and startup snapshot. The process shares at most 8 such sources and 256 MiB of them. Past that bound, a context evaluating another large source keeps its own copy, and its `heap_stats` count that source as mini_racer's do. V8 counts shared sources in `:external_memory` by character length, so two-byte text reports half its bytes. mini_racer 0.22.2 reports `:external_memory` as 0 and counts each context's own copy in `:used_heap_size`. JavaScript sees the same source text in both gems. Contexts created with `max_memory:` and sources that are not valid UTF-8 keep their own copies. Setting `MINI_RACER_RS_CODE_CACHE=off` before the first context prevents source sharing and makes `heap_stats` count every source as mini_racer does.
213
213
 
214
214
  Approved 2026-10-18.
215
215
 
216
216
  ### `behavior:snapshot-filter-context@ruby`
217
217
 
218
- mini_racer_rs returns the same filtered results from a snapshot-based context as from a context without a snapshot. In a context made from `MiniRacer::Snapshot.new("Object.getOwnPropertyDescriptors = () => ({})")`, `({a: 1, f() {}})` returns `{"a" => 1}`, and `[1, function() {}]` returns `[1]`. mini_racer 0.22.1 returns `nil` for both. Both gems copy results that V8 refuses to serialize as is through a filter in a separate safe context. mini_racer_rs keeps an untouched context in each snapshot blob and uses it for that filter, while mini_racer 0.22.1 builds the safe context from the snapshot, exposing the filter's built-ins to snapshot code. User code still sees the replacement in both gems: `Object.getOwnPropertyDescriptors({a: 1})` returns `{}`.
218
+ mini_racer_rs returns the same filtered results from a snapshot-based context as from a context without a snapshot. In a context made from `MiniRacer::Snapshot.new("Object.getOwnPropertyDescriptors = () => ({})")`, `({a: 1, f() {}})` returns `{"a" => 1}`, and `[1, function() {}]` returns `[1]`. mini_racer 0.22.2 returns `nil` for both. Both gems copy results that V8 refuses to serialize as is through a filter in a separate safe context. mini_racer_rs keeps an untouched context in each snapshot blob and uses it for that filter, while mini_racer 0.22.2 builds the safe context from the snapshot, exposing the filter's built-ins to snapshot code. User code still sees the replacement in both gems: `Object.getOwnPropertyDescriptors({a: 1})` returns `{}`.
219
219
 
220
220
  Approved 2026-10-16.
221
221
 
222
222
  ### `behavior:source-maps@ruby`
223
223
 
224
- After a source map is registered with `MiniRacerRs.register_source_map(bundle, map)`, `MiniRacer::RuntimeError` backtraces for contexts that evaluate a UTF-8 source containing the bundle show the mapped original file, line, and column for covered frames inside that bundle, while preserving V8's function name. mini_racer 0.22.1 has no source map support, so its runtime backtraces always show V8 positions. mini_racer_rs keeps V8 positions for async frames, frames after the tenth, `eval` and `new Function` code, frames outside the bundle, uncovered positions, and every frame when the reported frames do not align with V8's stack trace. `MiniRacer::ParseError` and `MiniRacer::ScriptError` messages are unchanged, as are JavaScript-visible values such as `Error.prototype.stack`. Latin-1 and UTF-16 sources and bundles in startup snapshots do not match. With no registered map, behavior is exactly that of mini_racer 0.22.1. Maps are process wide and limited to eight bundles. Affected contexts collect detailed stacks, increasing the measured cost of a 20-frame `new Error` from about 0.8 to 1.5 microseconds and a caught `throw {}` 20 frames deep from about 0.2 to 1.2 microseconds; measured React and MUI server renders were unchanged.
224
+ After a source map is registered with `MiniRacerRs.register_source_map(bundle, map)`, `MiniRacer::RuntimeError` backtraces for contexts that evaluate a UTF-8 source containing the bundle show the mapped original file, line, and column for covered frames inside that bundle, while preserving V8's function name. mini_racer 0.22.2 has no source map support, so its runtime backtraces always show V8 positions. mini_racer_rs keeps V8 positions for async frames, frames after the tenth, `eval` and `new Function` code, frames outside the bundle, uncovered positions, and every frame when the reported frames do not align with V8's stack trace. `MiniRacer::ParseError` and `MiniRacer::ScriptError` messages are unchanged, as are JavaScript-visible values such as `Error.prototype.stack`. Latin-1 and UTF-16 sources and bundles in startup snapshots do not match. With no registered map, behavior is exactly that of mini_racer 0.22.2. Maps are process wide and limited to eight bundles. Affected contexts collect detailed stacks, increasing the measured cost of a 20-frame `new Error` from about 0.8 to 1.5 microseconds and a caught `throw {}` 20 frames deep from about 0.2 to 1.2 microseconds; measured React and MUI server renders were unchanged.
225
225
 
226
226
  Approved 2026-10-18.
227
227
 
228
228
  ### `behavior:stack-exhaustion@ruby`
229
229
 
230
- mini_racer_rs raises `SystemStackError` with `stack level too deep` when converting a JavaScript result on a Ruby fiber or thread with too little machine stack remaining for Ruby to call a C function. When converting arguments for an attached Ruby callable, mini_racer_rs does not call the callable and gives JavaScript an Error with `stack level too deep`; if uncaught, `eval` raises that `SystemStackError` in Ruby. In both cases, the context remains usable and can evaluate `1 + 1` to `2` and dispose. Across 736 runs on 128 KiB fiber and thread stacks, using release and debug builds with and without `GC.stress` and compaction, mini_racer_rs never hung or crashed. On the same stack sizes without `GC.stress`, across 120 runs per conversion kind, mini_racer 0.22.1 results returned 59 times, raised `SystemStackError` 49 times, and hung 12 times, all for values containing Latin-1 or two-byte strings. mini_racer 0.22.1 callbacks delivered `stack level too deep` to JavaScript 87 times, returned 7 times, crashed with a segmentation fault 10 times, hung 8 times, and left 8 contexts unable to dispose with `context dispose: Device or resource busy`; with `GC.stress` and compaction, many result and callback runs aborted with `[BUG] system stack overflow during GC`. The tradeoff is stack cost: in a release build, a 95-level object result needed about 30 KiB beyond Ruby's method-call limit with mini_racer_rs, versus about 10 KiB with mini_racer 0.22.1, so near the end of a stack mini_racer_rs refuses some results that mini_racer 0.22.1 returns. At Ruby 3.4's default machine stacks, 512 KiB for a fiber and 1 MiB for a thread, mini_racer_rs converts every kind of value nested 95 levels deep.
230
+ mini_racer_rs raises `SystemStackError` with `stack level too deep` when it converts a JavaScript result on a Ruby fiber or thread with too little machine stack left for Ruby to call a C function. For attached callable arguments, it does not call the callable and gives JavaScript an Error with `stack level too deep`; if uncaught, `eval` raises that `SystemStackError`. The context remains usable and can evaluate `1 + 1` to `2` and dispose. Across 960 runs on 128 KiB fiber and thread stacks, covering release and debug builds with and without `GC.stress` and compaction, mini_racer_rs never hung or crashed. In mini_racer 0.22.2, 120 runs per kind without `GC.stress` produced 77 returned results, 30 `SystemStackError`s, and 13 hangs, including 12 for Latin-1 or two-byte strings. Callbacks delivered `stack level too deep` 58 times, returned 46 times, crashed 7 times, hung 3 times, and left 6 contexts unable to dispose with `context dispose: Device or resource busy`. With `GC.stress` and compaction, results aborted 36 times with `[BUG] system stack overflow during GC` and crashed 6 times; callbacks aborted 21 times and crashed 42 times. The tradeoff is stack cost. In release builds, a 95-level object result needed about 24 to 32 KiB beyond Ruby's method-call limit in mini_racer_rs, compared with about 8 to 16 KiB on a fiber and 2 to 4 KiB on a thread in mini_racer 0.22.2. Near the end of a stack, mini_racer_rs therefore refuses some results mini_racer returns. On Ruby 3.4's default 512 KiB fiber and 1 MiB thread stacks, mini_racer_rs converts every kind of value nested 95 levels deep.
231
231
 
232
- Approved 2026-10-18.
232
+ Approved 2026-10-23.
233
233
 
234
234
  ### `behavior:timeout-bounds-leftover-microtasks@ruby`
235
235
 
236
- mini_racer_rs applies the context’s timeout once more while running microtasks left by a script that reached its own timeout. Both gems run leftover microtasks before returning, but mini_racer 0.22.1's watchdog has already fired for that call, so it runs them without a time limit. For example, with `timeout: 200`, evaluating `Promise.resolve().then(() => { while (true) {} }); while (true) {}` never returns in mini_racer. In mini_racer_rs it raises `MiniRacer::ScriptTerminatedError` after about 400 ms, and the context remains usable. This also means mini_racer_rs cuts short a finite leftover microtask that needs more than the second 200 ms, while mini_racer finishes it. Microtasks left by a script ended another way, such as by `stop`, a memory limit, or an interrupt, keep the original deadline in both gems. Without `timeout:`, both run leftover microtasks without a limit. mini_racer_rs differs because `timeout:` often bounds untrusted JavaScript, and an endless microtask should not remove that bound.
236
+ mini_racer_rs applies the context’s timeout once more while running microtasks left by a script that reached its own timeout. Both gems run leftover microtasks before returning, but mini_racer 0.22.2's watchdog has already fired for that call, so it runs them without a time limit. For example, with `timeout: 200`, evaluating `Promise.resolve().then(() => { while (true) {} }); while (true) {}` never returns in mini_racer. In mini_racer_rs it raises `MiniRacer::ScriptTerminatedError` after about 400 ms, and the context remains usable. This also means mini_racer_rs cuts short a finite leftover microtask that needs more than the second 200 ms, while mini_racer finishes it. Microtasks left by a script ended another way, such as by `stop`, a memory limit, or an interrupt, keep the original deadline in both gems. Without `timeout:`, both run leftover microtasks without a limit. mini_racer_rs differs because `timeout:` often bounds untrusted JavaScript, and an endless microtask should not remove that bound.
237
237
 
238
238
  Approved 2026-10-17.
239
239
 
240
240
  ### `behavior:timeout-watchdog@ruby`
241
241
 
242
- mini_racer_rs raises MiniRacer::InternalError when its single process-wide watchdog thread cannot start, and the timed script does not run. mini_racer 0.22.1 starts a watchdog thread for each eval or call on a context created with timeout:; if creation fails, it prints mini_racer: watchdog: pthread_create: <error> to stderr and runs the script without a time limit. This difference prevents a failed watchdog from silently removing the bound often placed on untrusted JavaScript.
242
+ mini_racer_rs raises MiniRacer::InternalError when its single process-wide watchdog thread cannot start, and the timed script does not run. mini_racer 0.22.2 starts a watchdog thread for each eval or call on a context created with timeout:; if creation fails, it prints mini_racer: watchdog: pthread_create: <error> to stderr and runs the script without a time limit. This difference prevents a failed watchdog from silently removing the bound often placed on untrusted JavaScript.
243
243
 
244
244
  Approved 2026-10-16.
245
245
 
246
246
  ### `behavior:typed-array-offsets@ruby`
247
247
 
248
- mini_racer_rs returns a typed array or DataView at any byte offset as a binary (`ASCII-8BIT`) String containing the view's whole ArrayBuffer, consistent with both gems at offset 0. mini_racer 0.22.1 instead raises `MiniRacer::RuntimeError` with `bad typed array` for offsets such as those in `new Uint8Array(new ArrayBuffer(8), 4)` and `new DataView(new ArrayBuffer(4), 1, 2)`. Its decoder checks the byte after the view type, so offsets whose first encoded byte matches a view type letter can pass, including offset 66 for `B`.
249
-
250
- Approved 2026-10-16.
251
-
252
- ### `behavior:uncloneable-after-filter@ruby`
253
-
254
- mini_racer_rs returns an error Hash when a result remains uncloneable after both gems copy it through mini_racer's filter function, which keeps enumerable data and drops functions. For example, `({a: Symbol("s")})` returns `{"error" => "Error: Symbol(s) could not be cloned."}`. A Map with a function key is another such case. mini_racer 0.22.1 aborts the Ruby process with signal 6 (SIGABRT), although its code contains the fallback that returns V8's message in a Hash. mini_racer_rs uses that fallback.
248
+ mini_racer_rs returns a typed array or DataView at any byte offset as a binary (`ASCII-8BIT`) String containing the view's whole ArrayBuffer, consistent with both gems at offset 0. mini_racer 0.22.2 instead raises `MiniRacer::RuntimeError` with `bad typed array` for offsets such as those in `new Uint8Array(new ArrayBuffer(8), 4)` and `new DataView(new ArrayBuffer(4), 1, 2)`. Its decoder checks the byte after the view type, so offsets whose first encoded byte matches a view type letter can pass, including offset 66 for `B`.
255
249
 
256
250
  Approved 2026-10-16.
257
251
 
258
252
  ### `behavior:v8-version@ruby`
259
253
 
260
- On CRuby, `mini_racer_rs` embeds V8 15.2.124.1 through the `v8` crate 152.2.0, while `mini_racer` 0.22.1 uses V8 13.6.233.17 through `libv8-node` 24.12.0.1. V8-generated text, including parse and runtime error messages and locale formatting, can therefore differ. So can the nesting depth at which V8 stops reading a value: with the default stack limit, `Context#call` accepts arguments about 6,250 levels deep in `mini_racer_rs` and about 3,100 in `mini_racer` 0.22.1, and both limits halve with half the stack. In single-threaded mode, after `low_memory_notification` on a new context, `pump_message_loop` returns `true` in `mini_racer_rs` and `false` in `mini_racer` 0.22.1 because V8 15.2 posts a zero-delay foreground task during collection. Later pumps return `false` in both, as they do in the default multi-threaded mode. Affected upstream tests are marked `deviation:behavior:v8-version@ruby` in `test/upstream/mini_racer.status.toml`. This difference does not apply on TruffleRuby, where both gems use upstream's GraalJS backend.
261
-
262
- Approved 2026-10-16.
263
-
264
- ### `behavior:warmup-discards-context@ruby`
254
+ On CRuby, mini_racer_rs embeds V8 15.2.124.1 through the `v8` crate 152.2.0, while mini_racer 0.22.2 uses V8 13.6.233.17 through `libv8-node` 24.12.0.1. V8-generated text, including parse and runtime error messages and locale formatting, can therefore differ. In single-threaded mode, after `low_memory_notification` on a new context, `pump_message_loop` returns `true` in mini_racer_rs because V8 15.2 posts a zero-delay foreground task during collection, while it returns `false` in mini_racer 0.22.2. Later pumps return `false` in both, as they do in the default multi-threaded mode. This difference does not apply on TruffleRuby, where both gems use upstream's GraalJS backend.
265
255
 
266
- mini_racer_rs completes `Snapshot#warmup!` when the warmup script creates an object V8 cannot serialize, while mini_racer 0.22.1 stops the process with a `global handle not serialized` trap. mini_racer_rs releases the warmup context before writing the new snapshot blob, so its objects are not written. mini_racer 0.22.1 still holds that context while writing the blob. For `snapshot = MiniRacer::Snapshot.new("function f() { return 1 }")`, `snapshot.warmup!("var formatter = new Intl.DateTimeFormat('en'); f()")` succeeds in mini_racer_rs, and a context created from the snapshot evaluates `[f(), typeof formatter]` to `[1, "undefined"]`. Both gems use a fresh default context, so warmup variables are never part of the result.
267
-
268
- Approved 2026-10-16.
256
+ Approved 2026-10-23.
269
257
 
270
258
  ### `module:MiniRacer::Loader@ruby`
271
259
 
272
- `MiniRacer::Loader` and `MiniRacer::Loader.load` do not exist in mini_racer_rs, whose single native extension uses a plain `require`. Its dynamic exports are limited to per-platform allowlists, CI fails if any C++ or Rust symbol is exported, and on Linux it links with `-Bsymbolic` so its references bind to its own definitions. mini_racer 0.22.1 uses `mini_racer_loader` with `RTLD_LOCAL` and `RTLD_DEEPBIND`, except when `LD_PRELOAD` contains `malloc`; `LD_PRELOAD` does not change mini_racer_rs loading.
260
+ `MiniRacer::Loader` and `MiniRacer::Loader.load` do not exist in mini_racer_rs, whose single native extension uses a plain `require`. Its dynamic exports are limited to per-platform allowlists, CI fails if any C++ or Rust symbol is exported, and on Linux it links with `-Bsymbolic` so its references bind to its own definitions. mini_racer 0.22.2 uses `mini_racer_loader` with `RTLD_LOCAL` and `RTLD_DEEPBIND`, except when `LD_PRELOAD` contains `malloc`; `LD_PRELOAD` does not change mini_racer_rs loading.
273
261
 
274
262
  Approved 2026-10-16.
275
263
 
276
264
  ### `smethod:MiniRacer::Loader.load@ruby`
277
265
 
278
- `MiniRacer::Loader` and `MiniRacer::Loader.load` do not exist in mini_racer_rs, whose single native extension uses a plain `require`. Its dynamic exports are limited to per-platform allowlists, CI fails if any C++ or Rust symbol is exported, and on Linux it links with `-Bsymbolic` so its references bind to its own definitions. mini_racer 0.22.1 uses `mini_racer_loader` with `RTLD_LOCAL` and `RTLD_DEEPBIND`, except when `LD_PRELOAD` contains `malloc`; `LD_PRELOAD` does not change mini_racer_rs loading.
266
+ `MiniRacer::Loader` and `MiniRacer::Loader.load` do not exist in mini_racer_rs, whose single native extension uses a plain `require`. Its dynamic exports are limited to per-platform allowlists, CI fails if any C++ or Rust symbol is exported, and on Linux it links with `-Bsymbolic` so its references bind to its own definitions. mini_racer 0.22.2 uses `mini_racer_loader` with `RTLD_LOCAL` and `RTLD_DEEPBIND`, except when `LD_PRELOAD` contains `malloc`; `LD_PRELOAD` does not change mini_racer_rs loading.
279
267
 
280
268
  Approved 2026-10-16.
data/Cargo.lock CHANGED
@@ -555,9 +555,9 @@ dependencies = [
555
555
 
556
556
  [[package]]
557
557
  name = "magnus"
558
- version = "0.9.2"
558
+ version = "0.9.3"
559
559
  source = "registry+https://github.com/rust-lang/crates.io-index"
560
- checksum = "b9068710e00d21be762edca59b9c4c8946dbdb29820d4f76ad559afea07982c9"
560
+ checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
561
561
  dependencies = [
562
562
  "magnus-macros",
563
563
  "rb-sys",
@@ -593,7 +593,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
593
593
 
594
594
  [[package]]
595
595
  name = "mini_racer_engine"
596
- version = "1.4.0"
596
+ version = "1.5.1"
597
597
  dependencies = [
598
598
  "deno_core_icudata",
599
599
  "libc",
@@ -606,7 +606,7 @@ dependencies = [
606
606
 
607
607
  [[package]]
608
608
  name = "mini_racer_rs"
609
- version = "1.4.0"
609
+ version = "1.5.1"
610
610
  dependencies = [
611
611
  "magnus",
612
612
  "mini_racer_engine",
@@ -617,7 +617,7 @@ dependencies = [
617
617
 
618
618
  [[package]]
619
619
  name = "mini_racer_sourcemap"
620
- version = "1.4.0"
620
+ version = "1.5.1"
621
621
  dependencies = [
622
622
  "memchr",
623
623
  "serde",
@@ -627,7 +627,7 @@ dependencies = [
627
627
 
628
628
  [[package]]
629
629
  name = "mini_racer_sync"
630
- version = "1.4.0"
630
+ version = "1.5.1"
631
631
  dependencies = [
632
632
  "loom",
633
633
  "thiserror",
@@ -635,7 +635,7 @@ dependencies = [
635
635
 
636
636
  [[package]]
637
637
  name = "mini_racer_wire"
638
- version = "1.4.0"
638
+ version = "1.5.1"
639
639
  dependencies = [
640
640
  "criterion",
641
641
  "proptest",
data/Cargo.toml CHANGED
@@ -15,14 +15,14 @@ license = "MIT"
15
15
  publish = false
16
16
  repository = "https://github.com/andymai/mini_racer_rs"
17
17
  rust-version = "1.91"
18
- version = "1.4.0"
18
+ version = "1.5.1"
19
19
 
20
20
  [workspace.dependencies]
21
21
  criterion = {version = "0.8", default-features = false, features = ["cargo_bench_support"]}
22
22
  deno_core_icudata = "=0.78.0"
23
23
  libc = "0.2"
24
24
  loom = "0.7.2"
25
- magnus = {version = "=0.9.2", features = ["rb-sys"]}
25
+ magnus = {version = "=0.9.3", features = ["rb-sys"]}
26
26
  memchr = "2"
27
27
  mini_racer_engine = {path = "crates/mini_racer_engine"}
28
28
  mini_racer_sourcemap = {path = "crates/mini_racer_sourcemap"}
data/README.md CHANGED
@@ -9,28 +9,28 @@ A drop-in replacement for mini_racer, implemented in Rust on V8 15.2.
9
9
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
10
10
  [![Ruby 3.3 | 3.4 | 4.0](https://img.shields.io/badge/ruby-3.3%20%7C%203.4%20%7C%204.0-red.svg)](#scope)
11
11
  [![V8 15.2](https://img.shields.io/badge/V8-15.2-4285F4.svg)](#how-it-works)
12
- [![mini_racer 0.22.1 suite](https://img.shields.io/badge/mini__racer%200.22.1%20suite-passing-success.svg)](COMPATIBILITY.md)
12
+ [![mini_racer 0.22.2 suite](https://img.shields.io/badge/mini__racer%200.22.2%20suite-passing-success.svg)](COMPATIBILITY.md)
13
13
 
14
14
  **[Install](#install)** · **[Quick start](#quick-start)** · **[API](#api-at-a-glance)** · **[Switching](#switching-from-mini_racer)** · **[Benchmarks](#benchmarks)** · **[How it works](#how-it-works)** · **[Compatibility](COMPATIBILITY.md)** · **[Architecture](ARCHITECTURE.md)**
15
15
 
16
16
  </div>
17
17
 
18
- mini_racer_rs implements the `MiniRacer` API from mini_racer 0.22.1. It defines `MiniRacer` and ships `lib/mini_racer.rb`, so `require "mini_racer"` and ExecJS keep working.
18
+ mini_racer_rs implements the `MiniRacer` API from mini_racer 0.22.2. It defines `MiniRacer` and ships `lib/mini_racer.rb`, so `require "mini_racer"` and ExecJS keep working.
19
19
 
20
20
  > mini_racer_rs is an independent project and is not affiliated with the Discourse staff who maintain mini_racer.
21
21
 
22
22
  ## Highlights
23
23
 
24
- - **Round trips:** 5 to 9 times faster (0.72 µs vs 6.51 µs per call).
25
- - **Babel through ExecJS:** 1.95x faster (5.15 ms vs 10.05 ms).
24
+ - **Round trips:** 5 to 9 times faster (0.75 µs vs 6.45 µs per call).
25
+ - **Babel through ExecJS:** 1.97x faster (5.11 ms vs 10.06 ms).
26
26
  - **Bundle load:** 4.6x faster for a 44 MB production server rendering bundle (215 ms vs 983 ms).
27
- - **Memory:** A context holding the MUI bundle uses 44 MB vs 110 MB.
27
+ - **Memory:** A context holding the MUI bundle uses 43 MB vs 110 MB.
28
28
  - **Forks:** After loading and rendering React: 20 of 20 clean mini_racer_rs exits vs 20 of 20 mini_racer aborts.
29
- - **V8:** V8 15.2.124.1 vs V8 13.6.233.17 in mini_racer 0.22.1.
29
+ - **V8:** V8 15.2.124.1 vs V8 13.6.233.17 in mini_racer 0.22.2.
30
30
  - **No compiler:** Native gems cover glibc and musl Linux, including Alpine, and macOS, on both architectures, with Ruby 3.3, 3.4 and 4.0 extensions.
31
31
  - **Fiber scheduler:** Three 100 ms loops in separate contexts and fibers finish in 100 ms vs 300 ms.
32
- - **Upstream suites:** mini_racer passes 171 of 174 with 3 skipped by itself; ExecJS passes 197 of 198 with 1 skipped.
33
- - **Difficult values:** A `Map` with a function key returns an error Hash instead of aborting with SIGABRT.
32
+ - **Upstream suites:** mini_racer passes 187 of 190 with 3 skipped by itself; ExecJS passes 197 of 198 with 1 skipped.
33
+ - **Callback jumps:** A `throw` out of an attached callback ends the script with `Error: terminated` and continues after `eval`; mini_racer 0.22.2 crashes with a segmentation fault.
34
34
  - **Checks:** Script-enforced crate boundaries, four fenced `unsafe` modules, loom, wire-codec fuzzing, nightly sanitizers and mini_racer differential tests.
35
35
 
36
36
  These numbers compare with mini_racer 0.22.1. See [Benchmarks](#benchmarks) for the method.
@@ -177,7 +177,7 @@ The public API and require path stay the same. Changes include native installati
177
177
 
178
178
  - You're affected if an attached callback reenters its context from another fiber, including inside `Enumerator#next`. mini_racer_rs raises `ThreadError`; mini_racer allows it.
179
179
 
180
- - You're affected if a callback exits by `throw`, returns from a proc, or receives `Thread#kill`. The script ends with `Error: terminated`. The jump continues after `eval` returns. mini_racer hangs.
180
+ - You're affected if an attached callback exits by `throw`, returns from a proc while its method is still running, or receives `Thread#kill`. mini_racer_rs ends the script with `Error: terminated`, then continues the jump after `eval` or `call` returns. In mini_racer 0.22.2, `throw` and `return` cause a segmentation fault. `Thread#kill` gives JavaScript a catchable `Error: Ruby exception`; the script continues, and the thread ends after `eval` returns.
181
181
 
182
182
  - You're affected if JavaScript reads a callback exception's non-ASCII message. mini_racer_rs passes UTF-8, such as `"café"`; mini_racer passes `"café"`.
183
183
 
@@ -197,20 +197,20 @@ See [COMPATIBILITY.md](COMPATIBILITY.md) for every difference.
197
197
 
198
198
  ### Gems that depend on mini_racer
199
199
 
200
- If another gem adds `mini_racer`, point Bundler to the repository's shim. This empty `mini_racer` gem is version 0.22.1. It depends on the `mini_racer_rs` version from the same checkout.
200
+ If another gem adds `mini_racer`, point Bundler to the repository's shim. This empty `mini_racer` gem is version 0.22.2. It depends on the `mini_racer_rs` version from the same checkout.
201
201
 
202
202
  ```ruby
203
203
  gem "mini_racer_rs"
204
204
  gem "mini_racer", github: "andymai/mini_racer_rs", tag: "vX.Y.Z", glob: "shim/*.gemspec"
205
205
  ```
206
206
 
207
- The repository tests the `path:` form of the shim with rtlcss in `test/consumers/transitive/`. A dependency excluding `mini_racer` 0.22.1 cannot use the shim.
207
+ The repository tests the `path:` form of the shim with rtlcss in `test/consumers/transitive/`. A dependency excluding `mini_racer` 0.22.2 cannot use the shim.
208
208
 
209
209
  ### Forking servers such as Puma
210
210
 
211
211
  Before forking, evaluate each bundle of 1 MiB or more twice in the master, then dispose those contexts. Use the renderer's exact source text and file name. The second evaluation builds the process-wide V8 code cache. Matching evaluations compile from it, and forked children inherit it. For Babel's 2.3 MB bundle at commit `5e13c1c`, a forked child's first load took 60.8 ms without a parent load. It took 65.5 ms after one load and 25.0 ms after two. These are medians across 5 trials. Prime a `react-rails` app by building its server renderer twice. Children do not use parent contexts. Only the cache carries over.
212
212
 
213
- For Ruby's `fork`, `IO.popen("-")`, or `Process.daemon`, mini_racer_rs waits for context runners, pauses its worker pool and waits for running tasks. An async `WebAssembly.compile` in a new default-mode child completes on the child's own pool. On Ubuntu 24.04 with glibc 2.39, 20 of 20 mini_racer children aborted with signal 6 after React rendering; all mini_racer_rs children exited cleanly. On Fedora, mini_racer hung within 50 `test/stress/fork_busy.rb` forks; mini_racer_rs completed 300 per run on Fedora and Ubuntu.
213
+ For Ruby's `fork`, `IO.popen("-")`, or `Process.daemon`, mini_racer_rs waits for context runners, pauses its worker pool and waits for running tasks. An async `WebAssembly.compile` in a new default-mode child completes on the child's own pool. On Ubuntu 24.04 with glibc 2.39, 20 of 20 mini_racer 0.22.1 children aborted with signal 6 after React rendering; all mini_racer_rs children exited cleanly. mini_racer 0.22.2 has the same fork handling. On Fedora, `test/stress/fork_busy.rb` aborted with mini_racer 0.22.2 in 3 of 3 runs, after 5, 14 and 19 forks, when an evaluating parent thread raised `TypeError`. mini_racer_rs completed 300 forks per run on Fedora and Ubuntu.
214
214
 
215
215
  With `mini_racer` 0.22.1, each worker compiles the bundle from source on its first load because it has no code cache.
216
216
 
@@ -218,32 +218,33 @@ With `mini_racer` 0.22.1, each worker compiles the bundle from source on its fir
218
218
 
219
219
  | Workload | mini_racer 0.22.1 | mini_racer_rs | Ratio |
220
220
  |---|---:|---:|---:|
221
- | Babel transform of a 3 KB JSX component, through ExecJS | 10.1 ms | 5.2 ms | 2.0x |
222
- | Terser minify of a 78 KB library, through ExecJS | 51.1 ms | 52.0 ms | 1.0x |
223
- | React server render of 1,000 items (17 KB of HTML), through ExecJS | 191 µs | 174 µs | 1.1x |
224
- | React in a new context: load the bundle and render 1,000 items, through ExecJS | 11.9 ms | 11.8 ms | 1.0x |
225
- | Handlebars render of 50 rows, through `Context#call` | 49.1 µs | 34.9 µs | 1.4x |
226
- | Autoprefixer on Bootstrap's 280 KB stylesheet, through ExecJS | 26.3 ms | 23.7 ms | 1.1x |
227
- | MUI dashboard server render of 200 rows and 299 icons (469 KB of HTML), through ExecJS | 32.6 ms | 29.8 ms | 1.1x |
228
- | MUI in a new context: load the 8.2 MB bundle and render once, through ExecJS | 167 ms | 105 ms | 1.6x |
221
+ | Babel transform of a 3 KB JSX component, through ExecJS | 10.1 ms | 5.1 ms | 2.0x |
222
+ | Terser minify of a 78 KB library, through ExecJS | 51.4 ms | 50.9 ms | 1.0x |
223
+ | React server render of 1,000 items (17 KB of HTML), through ExecJS | 192 µs | 182 µs | 1.1x |
224
+ | React in a new context: load the bundle and render 1,000 items, through ExecJS | 11.8 ms | 11.8 ms | 1.0x |
225
+ | Handlebars render of 50 rows, through `Context#call` | 49.0 µs | 34.7 µs | 1.4x |
226
+ | Autoprefixer on Bootstrap's 280 KB stylesheet, through ExecJS | 26.2 ms | 23.8 ms | 1.1x |
227
+ | MUI dashboard server render of 200 rows and 299 icons (469 KB of HTML), through ExecJS | 30.3 ms | 29.2 ms | 1.0x |
228
+ | MUI in a new context: load the 8.2 MB bundle and render once, through ExecJS | 166 ms | 104 ms | 1.6x |
229
229
  | Load a 44 MB production server rendering bundle into a new context, through ExecJS | 983 ms | 215 ms | 4.6x |
230
230
 
231
- Results are medians of 5 runs. Every workload produced identical output in both gems. The eight library workloads use the release build of commit `220bfe7`. The 44 MB production bundle load uses commit `2513a48`. Benchmarks ran on Ruby 3.4.2 and Linux with an AMD Ryzen 9 7950X3D. The governor was `performance`. Both gems were pinned to CPUs 0 through 7.
231
+ Results are medians of 5 runs. Every workload produced identical output in both gems. The eight library workloads use one run of the Ruby 3.4 extension from the published mini_racer_rs 1.4.0 `x86_64-linux-gnu` gem. The 44 MB production bundle load uses commit `2513a48`. Benchmarks ran on Ruby 3.4.2 and Linux with an AMD Ryzen 9 7950X3D. The governor was `performance`. Both gems were pinned to CPUs 0 through 7.
232
232
 
233
- The per-call and memory figures below were measured on the same machine. Startup plus Babel, Babel context and MUI context figures come from commit `220bfe7`. One watchdog thread serves the whole process, making a call with `timeout:` fast. Scripts of 1 MiB or more use a process-wide V8 code cache. Contexts loading the same large script share one source copy.
233
+ The per-call and memory figures below come from the same run of that extension on the same machine. One watchdog thread serves the whole process, making a call with `timeout:` fast. Scripts of 1 MiB or more use a process-wide V8 code cache. Contexts loading the same large script share one source copy.
234
234
 
235
235
  | Measure | mini_racer 0.22.1 | mini_racer_rs |
236
236
  |---|---:|---:|
237
- | eval round trip | 6.91 µs | 1.09 µs |
238
- | call round trip | 6.51 µs | 0.72 µs |
239
- | callback round trip | 6.12 µs | 1.12 µs |
240
- | call on a context with `timeout:` | 20.48 µs | 0.76 µs |
237
+ | eval round trip | 6.76 µs | 1.14 µs |
238
+ | call round trip | 6.45 µs | 0.75 µs |
239
+ | callback round trip | 6.06 µs | 1.11 µs |
240
+ | call on a context with `timeout:` | 20.50 µs | 0.78 µs |
241
+ | call inside `MiniRacerRs.timeout` (mini_racer: on a context with `timeout:`) | 20.61 µs | 0.85 µs |
241
242
  | Babel inside V8 | 10.3 ms | 5.3 ms |
242
- | startup plus Babel | 44.4 ms | 13.3 ms |
243
- | context holding Babel | 28.5 MB | 15.2 MB |
244
- | context holding the 8.2 MB MUI bundle | 110 MB | 44 MB |
243
+ | startup plus Babel | 44.3 ms | 13.2 ms |
244
+ | context holding Babel | 28.5 MB | 15.0 MB |
245
+ | context holding the 8.2 MB MUI bundle | 110 MB | 43 MB |
245
246
  | context holding the 44 MB production bundle, at commit `2513a48` before sources were shared | 301 MB | 136 MB |
246
- | peak resident memory with 20,000 contexts left to Ruby's garbage collector | 2,920 MB | 102 MB |
247
+ | peak resident memory with 20,000 contexts left to Ruby's garbage collector | 2,910 MB | 106 MB |
247
248
 
248
249
  ```sh
249
250
  bundle exec ruby bench/run.rb --cpus 0-7
@@ -256,7 +257,7 @@ bundle exec ruby bench/run.rb --cpus 0-7
256
257
 
257
258
  | Engine | Done | Planned | Deviation |
258
259
  |---|---|---|---|
259
- | CRuby | 54 | 0 | 28 |
260
+ | CRuby | 54 | 0 | 26 |
260
261
  | TruffleRuby | 58 | 0 | 0 |
261
262
 
262
263
  See [COMPATIBILITY.md](COMPATIBILITY.md).
@@ -282,7 +283,7 @@ mini_racer_rs uses the `v8` crate, rusty_v8 152.2.0, with magnus and rb-sys Ruby
282
283
 
283
284
  A waiting Ruby thread spins with the GVL held, then without it. It then parks with the GVL released. After enough consecutive answers arrive beyond the spin budget, that context skips spinning and parks at once until an answer arrives within the budget. Under a fiber scheduler, only the waiting fiber parks. Values use V8's serialization format and decode directly into Ruby objects. There is no intermediate tree. Repeated objects keep their identity.
284
285
 
285
- One watchdog thread per process enforces every context's `timeout:`. In both platform modes, a fork through Ruby waits for every runner to be idle or parked. Under `:single_threaded`, the child takes over contexts whose runners were idle at the fork, while contexts in use raise there. Default multi-threaded children refuse every inherited context. mini_racer_rs gives V8 a copied platform vtable in each process. Worker-thread slots post to its own pool. V8's platform has one worker thread, which receives no tasks. Forking pauses the pool. The parent resumes it afterward.
286
+ One watchdog thread per process enforces every context's `timeout:`. Fork behavior is covered in [Forking servers such as Puma](#forking-servers-such-as-puma), and the protocol, including the worker pool that runs V8's tasks, is documented in [ARCHITECTURE.md](ARCHITECTURE.md#forks).
286
287
 
287
288
  The implementation has five crates:
288
289
 
@@ -300,24 +301,24 @@ The release pipeline runs the full suites for every released extension.
300
301
 
301
302
  mini_racer_rs does not:
302
303
 
303
- - Run on Windows. It supports glibc and musl Linux, including Alpine, on x86_64 and aarch64, and macOS on arm64 and x86_64.
304
+ - Run on Windows. Supported platforms are listed in [STABILITY.md](STABILITY.md#platforms-rubies-and-v8).
304
305
 
305
306
  - Provide Node.js APIs. JavaScript runs in plain V8 without file system, network, or process access. It can reach only Ruby callables you `attach`.
306
307
 
307
308
  - Work reliably without Bundler. RubyGems may activate the original mini_racer first.
308
309
 
309
- - Satisfy dependencies pinning `mini_racer` versions other than 0.22.1. This includes minibars and its `~> 0.6.4` requirement.
310
+ - Satisfy dependencies pinning `mini_racer` versions other than 0.22.2. This includes minibars and its `~> 0.6.4` requirement.
310
311
 
311
- - Extend the `MiniRacer` API beyond mini_racer 0.22.1. [COMPATIBILITY.md](COMPATIBILITY.md) records deliberate differences.
312
+ - Extend the `MiniRacer` API beyond mini_racer 0.22.2. [COMPATIBILITY.md](COMPATIBILITY.md) records deliberate differences.
312
313
 
313
- Supported implementations are CRuby 3.3, 3.4, and 4.0, plus TruffleRuby through mini_racer's unchanged TruffleRuby backend.
314
+ Supported Rubies include TruffleRuby through mini_racer's unchanged TruffleRuby backend, as listed in [STABILITY.md](STABILITY.md#platforms-rubies-and-v8).
314
315
 
315
316
  ## Documentation
316
317
 
317
318
  | Document | Covers |
318
319
  |---|---|
319
320
  | [ARCHITECTURE.md](ARCHITECTURE.md) | Crates, a call end to end, values, termination and limits, callbacks, promises and V8's tasks, snapshots, code cache, shared sources, fast calls, source maps, forks, fiber schedulers, rules that keep it safe, and how it is checked. |
320
- | [COMPATIBILITY.md](COMPATIBILITY.md) | Every public API item and deliberate difference from mini_racer 0.22.1, with its reason. |
321
+ | [COMPATIBILITY.md](COMPATIBILITY.md) | Every public API item and deliberate difference from mini_racer 0.22.2, with its reason. |
321
322
  | [BENCHMARKS.md](BENCHMARKS.md) | Benchmark method and full results. |
322
323
  | [STABILITY.md](STABILITY.md) | Versioning, the public API, unstable interfaces, and support policy. |
323
324
  | [SECURITY.md](SECURITY.md) | Vulnerability reporting, untrusted JavaScript, and supply-chain controls. |