Matej
Matej2d ago

SIGSEGV (invalid memory reference) after returning a freshly-compiled function

Hi all, apologies if this is not the right place to ask, but we're hitting an invalid memory reference error when using deno_core and would like to ask for help narrowing the problem down or even identifying the cause of the error. Here's a bit more context: we're using the deno_core crate to write a transpiler/interpreter[1] for the Nix language[2]. The nix language has an "import" mechanism, which we're trying to implement through a Rust function[3], that's available to the transpiled JS code in the global scope[4]. The segmentation fault happens in tests. Here are the reproduction steps: 1. Clone our repository (master branch): https://github.com/urbas/rix 2. Run RUST_TEST_THREADS=1 cargo test tests::builtins::import::eval You should get this test output:
running 6 tests
test tests::builtins::import::eval ... ok
test tests::builtins::import::eval_child_folder_import ... error: test failed, to rerun pass `--lib`

Caused by:
process didn't exit successfully: `/home/mat/git/rix/target/debug/deps/rix-3dce14f781aceeb3 'tests::builtins::import::eval'` (signal: 11, SIGSEGV: invalid memory reference)
running 6 tests
test tests::builtins::import::eval ... ok
test tests::builtins::import::eval_child_folder_import ... error: test failed, to rerun pass `--lib`

Caused by:
process didn't exit successfully: `/home/mat/git/rix/target/debug/deps/rix-3dce14f781aceeb3 'tests::builtins::import::eval'` (signal: 11, SIGSEGV: invalid memory reference)
Note that this segmentation fault does not happen if you run the test tests::builtins::import::eval_child_folder_import on its own. We also don't know why the error doesn't manifest itself in GitHub's action. The tests run sequentially and each test creates its own isolate. Any tips or hints on what we should look out for or change? Cheers! [1] https://github.com/urbas/rix [2] https://nix.dev/manual/nix/2.18/language/index.html [3] https://github.com/urbas/rix/blob/721f02a3ac9f1ffbe113cc60c8adf934c97d4c1d/src/eval/execution.rs#L98-L119 [4] https://github.com/urbas/rix/blob/721f02a3ac9f1ffbe113cc60c8adf934c97d4c1d/src/eval/execution.rs#L23-L37
0 Replies
No replies yetBe the first to reply to this messageJoin