mini_racer_rs 1.3.0 → 1.5.0
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/COMPATIBILITY.md +45 -48
- data/Cargo.lock +5 -5
- data/Cargo.toml +1 -1
- data/README.md +80 -37
- data/crates/mini_racer_engine/src/context.rs +45 -22
- data/crates/mini_racer_engine/src/control.rs +70 -1
- data/crates/mini_racer_engine/src/error.rs +66 -9
- data/crates/mini_racer_engine/src/lib.rs +3 -2
- data/crates/mini_racer_engine/src/process/platform.rs +360 -2
- data/crates/mini_racer_engine/src/process/watchdog.rs +63 -14
- data/crates/mini_racer_engine/src/runner.rs +274 -50
- data/crates/mini_racer_engine/src/snapshot.rs +259 -41
- data/crates/mini_racer_engine/src/sys.rs +26 -0
- data/crates/mini_racer_sourcemap/src/map.rs +3 -2
- data/crates/mini_racer_sync/src/termination.rs +183 -45
- data/ext/mini_racer_rs/src/context.rs +41 -23
- data/ext/mini_racer_rs/src/decode.rs +10 -2
- data/ext/mini_racer_rs/src/encode.rs +72 -27
- data/ext/mini_racer_rs/src/errors.rs +21 -6
- data/ext/mini_racer_rs/src/gc_root.rs +31 -1
- data/ext/mini_racer_rs/src/heap_limit.rs +42 -0
- data/ext/mini_racer_rs/src/host.rs +1 -1
- data/ext/mini_racer_rs/src/lib.rs +6 -0
- data/ext/mini_racer_rs/src/options.rs +90 -8
- data/ext/mini_racer_rs/src/pool.rs +811 -0
- data/ext/mini_racer_rs/src/rb_raw.rs +186 -1
- data/ext/mini_racer_rs/src/snapshot.rs +6 -10
- data/ext/mini_racer_rs/src/timeout.rs +132 -0
- data/lib/mini_racer/version.rb +1 -1
- data/lib/mini_racer_rs/heap_limit_error.rb +7 -0
- data/lib/mini_racer_rs/version.rb +1 -1
- data/lib/mini_racer_rs.rb +1 -0
- metadata +7 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bf41190f924dfa0445ada46e1b47ed422f25b4d88de74d4c4f0397f4190282c9
|
|
4
|
+
data.tar.gz: 330258ac6f3a92e31e23e8123dedeae52befe9eecb0a2409a10da574a9cf7893
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2fc22cbc008d1db4a8b8bf22e8d79177e20cd8ae97da99ab5f1962f601097dc8f37580ed4882ed5178c35c8be47bfb0d9a6b533fcf5b0ca281f928dfc2428c4b
|
|
7
|
+
data.tar.gz: 288df9055b1beb4231c3701e523a2176ac2907ae7762c8282c6534ca6119197c7f1c46a3ff1f534364c30c29825877637433a6144636e52ffd0d0d22da10e3e2
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.5.0](https://github.com/andymai/mini_racer_rs/compare/v1.4.0...v1.5.0) (2026-10-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* 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))
|
|
9
|
+
|
|
10
|
+
## [1.4.0](https://github.com/andymai/mini_racer_rs/compare/v1.3.0...v1.4.0) (2026-10-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* add MiniRacerRs::Pool for ready contexts replaced off the request path ([#131](https://github.com/andymai/mini_racer_rs/issues/131)) ([9087488](https://github.com/andymai/mini_racer_rs/commit/9087488faacc37d362a28efd6181b972f9ee0d30))
|
|
16
|
+
* add MiniRacerRs.heap_limit so heap exhaustion raises instead of aborting ([#130](https://github.com/andymai/mini_racer_rs/issues/130)) ([f58d1e0](https://github.com/andymai/mini_racer_rs/commit/f58d1e052b2e93b9d750d08b058f769abc81c471))
|
|
17
|
+
* add MiniRacerRs.timeout for per-call time budgets ([#128](https://github.com/andymai/mini_racer_rs/issues/128)) ([da4b529](https://github.com/andymai/mini_racer_rs/commit/da4b529c5ee685df57b3b35b26cbf41518aa667e))
|
|
18
|
+
|
|
3
19
|
## [1.3.0](https://github.com/andymai/mini_racer_rs/compare/v1.2.0...v1.3.0) (2026-10-23)
|
|
4
20
|
|
|
5
21
|
|
data/COMPATIBILITY.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# Compatibility with mini_racer 0.22.
|
|
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 |
|
|
7
|
+
| CRuby | 54 | 0 | 26 |
|
|
8
8
|
| TruffleRuby | 58 | 0 | 0 |
|
|
9
9
|
|
|
10
10
|
## Surface
|
|
@@ -88,184 +88,181 @@ What mini_racer_rs adds under `MiniRacerRs`. An internal id is not for callers.
|
|
|
88
88
|
|
|
89
89
|
| Id | CRuby | TruffleRuby |
|
|
90
90
|
|---|---|---|
|
|
91
|
+
| `class:MiniRacerRs::HeapLimitError < MiniRacer::V8OutOfMemoryError` | done | n/a |
|
|
91
92
|
| `class:MiniRacerRs::Pins < Object` | internal | n/a |
|
|
93
|
+
| `class:MiniRacerRs::Pool < Object` | done | n/a |
|
|
94
|
+
| `class:MiniRacerRs::Pool::ShutdownError < MiniRacer::Error` | done | n/a |
|
|
92
95
|
| `class:MiniRacerRs::Spill < Object` | internal | n/a |
|
|
96
|
+
| `class:MiniRacerRs::TimeoutScope < Object` | internal | n/a |
|
|
93
97
|
| `const:MiniRacerRs::NATIVE_VERSION` | done | n/a |
|
|
94
98
|
| `const:MiniRacerRs::V8_VERSION` | done | n/a |
|
|
95
99
|
| `const:MiniRacerRs::VERSION` | done | done |
|
|
96
100
|
| `imethod:MiniRacerRs::ForkHook#_fork` | internal | n/a |
|
|
97
101
|
| `imethod:MiniRacerRs::ForkHook#daemon` | internal | n/a |
|
|
102
|
+
| `imethod:MiniRacerRs::Pool#shutdown` | done | n/a |
|
|
103
|
+
| `imethod:MiniRacerRs::Pool#with` | done | n/a |
|
|
98
104
|
| `module:MiniRacerRs` | done | done |
|
|
99
105
|
| `module:MiniRacerRs::ForkHook` | internal | n/a |
|
|
100
106
|
| `smethod:MiniRacerRs.counters` | done | n/a |
|
|
107
|
+
| `smethod:MiniRacerRs.heap_limit` | done | n/a |
|
|
108
|
+
| `smethod:MiniRacerRs.heap_limit=` | done | n/a |
|
|
101
109
|
| `smethod:MiniRacerRs.register_source_map` | done | n/a |
|
|
110
|
+
| `smethod:MiniRacerRs.timeout` | done | n/a |
|
|
102
111
|
|
|
103
112
|
## Deviations
|
|
104
113
|
|
|
105
114
|
### `behavior:bigint-objects@ruby`
|
|
106
115
|
|
|
107
|
-
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.
|
|
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.
|
|
108
117
|
|
|
109
118
|
Approved 2026-10-16.
|
|
110
119
|
|
|
111
120
|
### `behavior:callback-error-text@ruby`
|
|
112
121
|
|
|
113
|
-
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.
|
|
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.
|
|
114
123
|
|
|
115
124
|
Approved 2026-10-16.
|
|
116
125
|
|
|
117
126
|
### `behavior:callback-jump@ruby`
|
|
118
127
|
|
|
119
|
-
mini_racer_rs terminates
|
|
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.
|
|
120
129
|
|
|
121
|
-
Approved 2026-10-
|
|
130
|
+
Approved 2026-10-23.
|
|
122
131
|
|
|
123
132
|
### `behavior:callback-reentry@ruby`
|
|
124
133
|
|
|
125
|
-
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.
|
|
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.
|
|
126
135
|
|
|
127
136
|
Approved 2026-10-16.
|
|
128
137
|
|
|
129
138
|
### `behavior:dispose-in-flight@ruby`
|
|
130
139
|
|
|
131
|
-
`MiniRacer::Context#dispose` in mini_racer_rs returns only after the runner
|
|
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.
|
|
132
141
|
|
|
133
|
-
Approved 2026-10-
|
|
142
|
+
Approved 2026-10-23.
|
|
134
143
|
|
|
135
144
|
### `behavior:fast-calls@ruby`
|
|
136
145
|
|
|
137
|
-
Unlike mini_racer 0.22.
|
|
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.
|
|
138
147
|
|
|
139
148
|
Approved 2026-10-18.
|
|
140
149
|
|
|
141
150
|
### `behavior:fiber-scheduler@ruby`
|
|
142
151
|
|
|
143
|
-
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.
|
|
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.
|
|
144
153
|
|
|
145
154
|
Approved 2026-10-16.
|
|
146
155
|
|
|
147
156
|
### `behavior:fork-from-callback@ruby`
|
|
148
157
|
|
|
149
|
-
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.
|
|
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`.
|
|
150
159
|
|
|
151
160
|
Approved 2026-10-16.
|
|
152
161
|
|
|
153
162
|
### `behavior:fork-quiesce-bound@ruby`
|
|
154
163
|
|
|
155
|
-
With
|
|
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.
|
|
156
165
|
|
|
157
|
-
Approved 2026-10-
|
|
166
|
+
Approved 2026-10-23.
|
|
158
167
|
|
|
159
168
|
### `behavior:fork-wait@ruby`
|
|
160
169
|
|
|
161
|
-
For
|
|
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.
|
|
162
171
|
|
|
163
|
-
Approved 2026-10-
|
|
172
|
+
Approved 2026-10-23.
|
|
164
173
|
|
|
165
174
|
### `behavior:invalid-snapshot@ruby`
|
|
166
175
|
|
|
167
|
-
|
|
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.
|
|
168
177
|
|
|
169
|
-
Approved 2026-10-
|
|
178
|
+
Approved 2026-10-23.
|
|
170
179
|
|
|
171
180
|
### `behavior:multi-threaded-fork@ruby`
|
|
172
181
|
|
|
173
|
-
In a child forked from a process using V8's default multi-threaded platform, mini_racer 0.22.
|
|
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`.
|
|
174
183
|
|
|
175
|
-
Approved 2026-10-
|
|
184
|
+
Approved 2026-10-23.
|
|
176
185
|
|
|
177
186
|
### `behavior:native-fork@ruby`
|
|
178
187
|
|
|
179
|
-
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.
|
|
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`.
|
|
180
189
|
|
|
181
190
|
Approved 2026-10-16.
|
|
182
191
|
|
|
183
192
|
### `behavior:object-ids@ruby`
|
|
184
193
|
|
|
185
|
-
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.
|
|
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.
|
|
186
195
|
|
|
187
196
|
Approved 2026-10-16.
|
|
188
197
|
|
|
189
198
|
### `behavior:padded-two-byte-text@ruby`
|
|
190
199
|
|
|
191
|
-
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.
|
|
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.
|
|
192
201
|
|
|
193
202
|
Approved 2026-10-16.
|
|
194
203
|
|
|
195
204
|
### `behavior:platforms@ruby`
|
|
196
205
|
|
|
197
|
-
mini_racer_rs ships native gems for the platforms libv8-node publishes gems for, which mini_racer 0.22.
|
|
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.
|
|
198
207
|
|
|
199
208
|
Approved 2026-10-22.
|
|
200
209
|
|
|
201
210
|
### `behavior:shared-source-heap-stats@ruby`
|
|
202
211
|
|
|
203
|
-
`Context#heap_stats` reports shared sources differently from mini_racer 0.22.
|
|
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.
|
|
204
213
|
|
|
205
214
|
Approved 2026-10-18.
|
|
206
215
|
|
|
207
216
|
### `behavior:snapshot-filter-context@ruby`
|
|
208
217
|
|
|
209
|
-
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.
|
|
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 `{}`.
|
|
210
219
|
|
|
211
220
|
Approved 2026-10-16.
|
|
212
221
|
|
|
213
222
|
### `behavior:source-maps@ruby`
|
|
214
223
|
|
|
215
|
-
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.
|
|
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.
|
|
216
225
|
|
|
217
226
|
Approved 2026-10-18.
|
|
218
227
|
|
|
219
228
|
### `behavior:stack-exhaustion@ruby`
|
|
220
229
|
|
|
221
|
-
mini_racer_rs raises `SystemStackError` with `stack level too deep` when
|
|
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.
|
|
222
231
|
|
|
223
|
-
Approved 2026-10-
|
|
232
|
+
Approved 2026-10-23.
|
|
224
233
|
|
|
225
234
|
### `behavior:timeout-bounds-leftover-microtasks@ruby`
|
|
226
235
|
|
|
227
|
-
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.
|
|
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.
|
|
228
237
|
|
|
229
238
|
Approved 2026-10-17.
|
|
230
239
|
|
|
231
240
|
### `behavior:timeout-watchdog@ruby`
|
|
232
241
|
|
|
233
|
-
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.
|
|
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.
|
|
234
243
|
|
|
235
244
|
Approved 2026-10-16.
|
|
236
245
|
|
|
237
246
|
### `behavior:typed-array-offsets@ruby`
|
|
238
247
|
|
|
239
|
-
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.
|
|
240
|
-
|
|
241
|
-
Approved 2026-10-16.
|
|
242
|
-
|
|
243
|
-
### `behavior:uncloneable-after-filter@ruby`
|
|
244
|
-
|
|
245
|
-
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`.
|
|
246
249
|
|
|
247
250
|
Approved 2026-10-16.
|
|
248
251
|
|
|
249
252
|
### `behavior:v8-version@ruby`
|
|
250
253
|
|
|
251
|
-
On CRuby,
|
|
252
|
-
|
|
253
|
-
Approved 2026-10-16.
|
|
254
|
-
|
|
255
|
-
### `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.
|
|
256
255
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
Approved 2026-10-16.
|
|
256
|
+
Approved 2026-10-23.
|
|
260
257
|
|
|
261
258
|
### `module:MiniRacer::Loader@ruby`
|
|
262
259
|
|
|
263
|
-
`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.
|
|
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.
|
|
264
261
|
|
|
265
262
|
Approved 2026-10-16.
|
|
266
263
|
|
|
267
264
|
### `smethod:MiniRacer::Loader.load@ruby`
|
|
268
265
|
|
|
269
|
-
`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.
|
|
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.
|
|
270
267
|
|
|
271
268
|
Approved 2026-10-16.
|
data/Cargo.lock
CHANGED
|
@@ -593,7 +593,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
|
|
|
593
593
|
|
|
594
594
|
[[package]]
|
|
595
595
|
name = "mini_racer_engine"
|
|
596
|
-
version = "1.
|
|
596
|
+
version = "1.5.0"
|
|
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.
|
|
609
|
+
version = "1.5.0"
|
|
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.
|
|
620
|
+
version = "1.5.0"
|
|
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.
|
|
630
|
+
version = "1.5.0"
|
|
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.
|
|
638
|
+
version = "1.5.0"
|
|
639
639
|
dependencies = [
|
|
640
640
|
"criterion",
|
|
641
641
|
"proptest",
|
data/Cargo.toml
CHANGED
|
@@ -15,7 +15,7 @@ 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.
|
|
18
|
+
version = "1.5.0"
|
|
19
19
|
|
|
20
20
|
[workspace.dependencies]
|
|
21
21
|
criterion = {version = "0.8", default-features = false, features = ["cargo_bench_support"]}
|