hiliujunyi / jav8

java wrap v8(javascript)
0 stars 0 forks source link

Memory access issue when loading jav8 from a second thread #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Test case:

    @Test
    public void testThreads() throws java.lang.InterruptedException, ScriptException {
        new ScriptEngineManager().getEngineByName("jav8");
        System.gc();

        new Thread(new Runnable() {
            public void run() {
                new ScriptEngineManager().getEngineByName("jav8");
            }
        }).start();

        Thread.sleep(1000);
    }

Produces output:

    [junit] Invalid memory access of location 0x10 rip=0x10dd18cbe

I've traced it back to line 178 of jav8.cpp, the call to 

  jni::V8Env env(pEnv);

Inside of 

jlong JNICALL Java_lu_flier_script_V8Context_internalCreate(JNIEnv *pEnv, 
jobject pObj)

Thanks for your help!

Original issue reported on code.google.com by gfo...@gmail.com on 23 Feb 2012 at 10:44

GoogleCodeExporter commented 9 years ago
Mac OSX Snow Leopard, x64 java 1.6

Original comment by gfo...@gmail.com on 23 Feb 2012 at 10:45

GoogleCodeExporter commented 9 years ago
This is now closed

Original comment by gfo...@gmail.com on 7 Mar 2012 at 8:54