rr VS quickjs-emscripten

Compare rr vs quickjs-emscripten and see what are their differences.

quickjs-emscripten

Safely execute untrusted Javascript in your Javascript, and execute synchronous code that uses async functions (by justjake)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
rr quickjs-emscripten
102 21
8,621 1,115
1.1% -
9.6 9.4
6 days ago 10 days ago
C++ TypeScript
GNU General Public License v3.0 or later GNU General Public License v3.0 or later
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

rr

Posts with mentions or reviews of rr. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-04-18.
  • rr: Lightweight Recording and Deterministic Debugging
    1 project | news.ycombinator.com | 21 Apr 2024
  • Hermit is a hermetic and reproducible sandbox for running programs
    3 projects | news.ycombinator.com | 18 Apr 2024
    I think this tool must share a lot techniques and use cases with rr. I wonder how it compares in various aspects.

    https://rr-project.org/

    rr "sells" as a "reversible debugger", but it obviously needs the determinism for its record and replay to work, and AFAIK it employs similar techniques regarding system call interception and serializing on a single CPU. The reversible debugger aspect is built on periodic snapshotting on top of it and replaying from those snapshots, AFAIK. They package it in a gdb compatible interface.

    Hermit also lists record/replay as a motivation, although it doesn't list reversible debugging in general.

  • Rr: Lightweight Recording and Deterministic Debugging
    1 project | news.ycombinator.com | 10 Apr 2024
  • Deep Bug
    1 project | news.ycombinator.com | 10 Apr 2024
    Interesting. Perhaps you can inspect the disassembly of the function in question when using Graal and HotSpot. It is likely related to that.

    Another debugging technique we use for heisenbugs is to see if `rr` [1] can reproduce it. If it can then that's great as it allows you to go back in time to debug what may have caused the bug. But `rr` is often not great for concurrency bugs since it emulates a single-core machine. Though debugging a VM is generally a nightmare. What we desperately need is a debugger that can debug both the VM and the language running on top of it. Usually it's one or the other.

    > In general I’d argue you haven’t fixed a bug unless you understand why it happened and why your fix worked, which makes this frustrating, since every indication is that the bug exists within proprietary code that is out of my reach.

    Were you using Oracle GraalVM? GraalVM community edition is open source, so maybe it's worth checking if it is reproducible in that.

    [1]: https://github.com/rr-debugger/rr

  • So you think you want to write a deterministic hypervisor?
    2 projects | news.ycombinator.com | 20 Mar 2024
    https://rr-project.org/ had the same problem. They use the retired conditional branch counter instead of instruction counter, and then instruction steeping until at the correct address.
  • Is Something Bugging You?
    10 projects | news.ycombinator.com | 13 Feb 2024
    That'll work great for your Distributed QSort Incorporated startup, where the only product is a sorting algorithm.

    Formal software verification is very useful. But what can be usefully formalized is rather limited, and what can be formalized correctly in practice is even more limited. That means you need to restrict your scope to something sane and useful. As a result, in the real world running thousands of tests is practically useful. (Well, it depends on what those tests are; it's easy to write 1000s of tests that either test the same thing, or only test the things that will pass and not the things that would fail.) They are especially useful if running in a mode where the unexpected happens often, as it sounds like this system can do. (It's reminiscent of rr's chaos mode -- https://rr-project.org/ linking to https://robert.ocallahan.org/2016/02/introducing-rr-chaos-mo... )

  • When "letting it crash" is not enough
    4 projects | news.ycombinator.com | 7 Feb 2024
    The approach of check-pointing computation such that it is resumable and restartable sounds similar to a time-traveling debugger, like rr or WinDbg:

    https://rr-project.org/

    https://learn.microsoft.com/windows-hardware/drivers/debugge...

  • When I got started I debugged using printf() today I debug with print()
    3 projects | news.ycombinator.com | 30 Jan 2024
  • Rr: Record and Replay Debugger – Reverse Debugger
    1 project | news.ycombinator.com | 9 Jan 2024
  • OpenBSD KDE Plasma Desktop
    2 projects | news.ycombinator.com | 8 Jan 2024
    https://github.com/rr-debugger/rr?tab=readme-ov-file#system-...

quickjs-emscripten

Posts with mentions or reviews of quickjs-emscripten. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-12-09.
  • New QuickJS Release
    6 projects | news.ycombinator.com | 9 Dec 2023
    Based on your comment below I think you figured out the difference - but if you're looking to execute JS, you can pick between ShadowRealm (where available, or using a polyfill) or my library quickjs-emscripten.

    Pros of quickjs-emscripten over ShadowRealm:

    - You can use quickjs today in any browser with WASM. ShadowRealm isn't available yet, and polyfills have had security issues in the past. See https://www.figma.com/blog/an-update-on-plugin-security/

    - In ShadowRealm eval, untrusted code can consume arbitrary CPU cycles. With QuickJS, you can control the CPU time used during an `eval` using an [interrupt handler] that's called periodically during the eval.

    - In ShadowRealm eval, untrusted code can allocate arbitrary amounts of memory. With QuickJS, you can control both the [stack size] and the [heap size] available inside the runtime.

    - quickjs-emscripten can do interesting things with custom module loaders and facades that allow synchronous code inside the runtime to call async code on the host.

    Pros of ShadowRealm over QuickJS:

    - ShadowRealm will (presumably?) execute code using your native runtime, probably v8, JavaScriptCore, or SpiderMonkey. Quickjs is orders of magnitude slower than JIT'd javascript performance of v8 etc. It's also slower than v8/JSC's interpreters, although not by a huge amount. See [benchmarks] from 2019.

    - You can easily call and pass values to ShadowRealm imported functions. Talking to quickjs-emscripten guest code requires a lot of fiddly and manual object building.

    - Overall the quickjs(-emscripten) API is verbose, and requires manual memory management of references to values inside the quickjs runtime.

    [interrupt handler]: https://github.com/justjake/quickjs-emscripten/blob/main/doc...

    [stack size]: https://github.com/justjake/quickjs-emscripten/blob/main/doc...

    [heap size]: https://github.com/justjake/quickjs-emscripten/blob/main/doc...

    [benchmarks]: https://bellard.org/quickjs/bench.html

  • Extism Makes WebAssembly Easy
    13 projects | news.ycombinator.com | 4 Oct 2023
    The thing I want to achieve with WebAssembly is still proving a lot harder than I had anticipated.

    I want to be able to take strings of untrusted code provided by users and execute them in a safe sandbox.

    I have all sorts of things I want this for - think custom templates for a web application, custom workflow automation scripts (Zapier-style), running transformations against JSON data.

    When you're dealing with untrusted code you need a really robust sandbox. WebAssembly really should be that sandbox.

    I'd like to support Python, JavaScript and maybe other languages too. I want to take a user-provided string of code in one of those languages and execute that in a sandbox with a strict limit on both memory usage and time taken (so I can't be crashed by a "while True" loop). If memory or time limit are exceeded, I want to get an exception which I can catch and return an error message to the user.

    I've been exploring options for this for quite a while now. The furthest I've got was running Pyodide inside of Deno: https://til.simonwillison.net/deno/pyodide-sandbox

    Surprisingly I've not found a good pattern for running a JavaScript interpreter in a WASM sandbox yet. https://github.com/justjake/quickjs-emscripten looks promising but I've not found the right recipe to call it from server-side Python or Deno yet.

    Can Extism help with this? I'm confident I'm not the only person who's looking for a solution here!

  • Node on Web. Use Nodejs freely in your browser with Linux infrastructure.
    8 projects | /r/node | 3 Jul 2023
    "Safely execute untrusted Javascript in your Javascript, and execute synchronous code that uses async functions" quickjs-emscripten, NPM
  • Sandboxing JavaScript Code
    2 projects | news.ycombinator.com | 19 Apr 2023
    This maybe, as a start?

    https://github.com/justjake/quickjs-emscripten

  • Hacker News top posts: Nov 20, 2022
    5 projects | /r/hackerdigest | 20 Nov 2022
    QuickJS Running in WebAssembly\ (17 comments)
  • QuickJS Running in WebAssembly
    1 project | /r/hypeurls | 19 Nov 2022
    4 projects | news.ycombinator.com | 19 Nov 2022
    The library was inspired by Figma’s blog posts about their plug-in system: https://github.com/justjake/quickjs-emscripten#background
  • Show HN: Run unsafe user generated JavaScript in the browser
    14 projects | news.ycombinator.com | 19 Nov 2022
    If you need to call into user-generated Javascript synchronously or have greater control over the sandbox environment, you can use WebAssembly to run a Javascript interpreter: https://github.com/justjake/quickjs-emscripten#quickjs-emscr...

    QuickJS in WebAssembly is much slower than your browser's native Javascript runtime, but possibly faster than async calls using postMessage. As an added bonus, it can make async functions in the host appear to be synchronous inside the sandbox using asyncify: https://emscripten.org/docs/porting/asyncify.html.

  • Why Would Anyone Need JavaScript Generator Functions?
    19 projects | news.ycombinator.com | 7 Nov 2022
    You can use One Weird Trick with generator functions to make your code "generic" over synchronicity. I use this technique to avoid needing to implement both sync and async versions of some functions in my quickjs-emscripten library.

    The great part about this technique as a library author is that unlike choosing to use a Promise return type, this technique is invisible in my public API. I can write a function like `export function coolAlgorithm(getData: (request: I) => O | Promise): R | Promise`, and we get automatic performance improvement if the user's function happens to return synchronously, without mystery generator stuff showing up in the function signature.

    Helper to make a function that can be either sync or async: https://github.com/justjake/quickjs-emscripten/blob/ff211447...

    Uses: https://cs.github.com/justjake/quickjs-emscripten?q=yield*+l...

  • Why Am I Excited About WebAssembly?
    9 projects | news.ycombinator.com | 17 Jul 2022
    This seems like a pretty nice, recently enabled way of getting a sandboxed js environment: QuickJS compiled to WASM: https://github.com/justjake/quickjs-emscripten.

What are some alternatives?

When comparing rr and quickjs-emscripten you can also consider the following projects:

CodeLLDB - A native debugger extension for VSCode based on LLDB

wasmtime - A fast and secure runtime for WebAssembly

rrweb - record and replay the web

wasmer - 🚀 The leading Wasm Runtime supporting WASIX, WASI and Emscripten

gef - GEF (GDB Enhanced Features) - a modern experience for GDB with advanced debugging capabilities for exploit devs & reverse engineers on Linux

wizer - The WebAssembly Pre-Initializer

Module Linker - browse modules by clicking directly on "import" statements on GitHub

go - The Go programming language

nbdev - Create delightful software with Jupyter Notebooks

iPlug2 - C++ Audio Plug-in Framework for desktop, mobile and web

clog-cli - Generate beautiful changelogs from your Git commit history

mach - zig game engine & graphics toolkit