servo / rust-mozjs

DEPRECATED - moved to servo/mozjs instead.
Mozilla Public License 2.0
293 stars 122 forks source link

Intermittent crash when testing #246

Open emilio opened 8 years ago

emilio commented 8 years ago

Today the test build got a segfault on travis on #245 (see: https://travis-ci.org/servo/rust-mozjs/builds/114398074).

I was able to reproduce it intermittently. Here's the backtrace:

$ gdb ./target/debug/js-817a35fac43d5b89
Thread 10 "Analysis Helper" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff6ae2700 (LWP 13337)]
0x00007ffff7432400 in __lll_unlock_elision () from /usr/lib/libpthread.so.0
(gdb) bt full
#0  0x00007ffff7432400 in __lll_unlock_elision () from /usr/lib/libpthread.so.0
No symbol table info available.
#1  0x00007ffff742cfb7 in pthread_cond_wait@@GLIBC_2.3.2 () from /usr/lib/libpthread.so.0
No symbol table info available.
#2  0x000055555576f379 in PR_WaitCondVar (cvar=0x7ffff4e0d040, 
    timeout=timeout@entry=4294967295)
    at /home/emilio/.multirust/toolchains/nightly/cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/PosixNSPR.cpp:286
No locals.
#3  0x000055555571e569 in js::GlobalHelperThreadState::wait (millis=0, 
    which=js::GlobalHelperThreadState::PRODUCER, this=<optimized out>)
    at /home/emilio/.multirust/toolchains/nightly/cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/HelperThreads.cpp:551
No locals.
#4  js::HelperThread::threadLoop (this=0x7ffff4e37100)
    at /home/emilio/.multirust/toolchains/nightly/cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/HelperThreads.cpp:1399
        ionCompile = false
        stackLimit = <optimized out>
#5  0x000055555576b029 in nspr::Thread::ThreadRoutine (arg=0x7ffff4e0c080)
    at /home/emilio/.multirust/toolchains/nightly/cargo/git/checkouts/mozjs-06d7f04b6dbb8a8e/master/mozjs/js/src/vm/PosixNSPR.cpp:45
        self = 0x7ffff4e0c080
#6  0x00007ffff7427424 in start_thread () from /usr/lib/libpthread.so.0
No symbol table info available.
#7  0x00007ffff6f50cbd in clone () from /usr/lib/libc.so.6

Running a single test at a time I don't seem able to reproduce the issue, maybe a race condition due to multiple runtimes started simultaneously?

Ms2ger commented 8 years ago

Yeah, that's not good. We need to call JS_Init from std::sync::Once, and set RUST_TEST_THREADS=1.