Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running cargo test causes a segfault. #217

Closed
tekul opened this issue Sep 19, 2023 · 5 comments
Closed

Running cargo test causes a segfault. #217

tekul opened this issue Sep 19, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@tekul
Copy link

tekul commented Sep 19, 2023

The details are as reported in denoland/deno#19926. Essentially we are using deno embedded in a project and started seeing segfaults after a particular version. I noticed that I saw the same issue when running cargo test in deno, and also in deno_core (anything with v8 after version 0.74.3).

As described in my last comment in that issue, I get a segfault running cargo clean followed by cargo test with the latest deno_core 6a369d5.

Thread 46 "modules::tests:" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff63f36c0 (LWP 36038)]
0x00005555569e23da in v8::internal::ThreadIsolation::RegisterJitPage(unsigned long, unsigned long) () at ../../../../v8/src/common/code-memory-access.cc:362

The machine is running Arch Linux:

$ uname -a
Linux celeste 6.5.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 13 Sep 2023 08:37:40 +0000 x86_64 GNU/Linux

I also get the same error on a different laptop using the same OS.

@lucacasonato
Copy link
Member

This is a bug on Linux on modern Intel & AMD CPUs. We are aware of the issue, and are planning to address it soon. @tekul running individual tests should succeed - it's just running the entire suite that fails.

@lucacasonato lucacasonato added the bug Something isn't working label Sep 20, 2023
@juli1
Copy link

juli1 commented Oct 6, 2023

Thanks for reporting it. This bug also impacts our project, which crashes on x86.

@juli1
Copy link

juli1 commented Dec 20, 2023

Bump this, this is impacting users and there is still no solution today.

@tekul
Copy link
Author

tekul commented Dec 20, 2023

A workaround we found if your project is using deno in rust tests is to use the ctor crate to make sure the runtime is initialized before the tests are run. i.e. in lib.rs add:

#[cfg(test)]
use ctor::ctor;

#[cfg(test)]
#[ctor]
// Make sure deno runtime is initialized in the main thread in test executables.
fn init_deno_runtime() {
    deno_core::JsRuntime::init_platform(None);
}

@Digifox03
Copy link
Contributor

This was fixed by #471

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants