harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Xiao-Feng Li" <xiaofeng...@gmail.com>
Subject Re: [general][porting] freebsd7/x86_64 (and x86)
Date Thu, 04 Sep 2008 22:36:30 GMT
Thanks for the enabling of build on freebsd7. Looks like the hangs
with default thread lib happens in finalizer_thread_init. Will check
if that is reason.

Thanks,
xiaofeng

On Fri, Sep 5, 2008 at 3:46 AM, Mark Hindess
<mark.hindess@googlemail.com> wrote:
>
> I can now build drlvm and classlib on freebsd7/x86_64 (and freebsd7/x86).
> That's the good news.  The bad news is that it is still in pretty much the
> same state freebsd 6.3 was when I last posted about that...
>
> Using the default thread library (libthr.so.3), running HelloWorld hangs.
> gdb shows:
>
> (gdb) info threads
> * 1 Thread 0x801101120 (LWP 100041)  0x0000000800b54d4c in _umtx_op ()
>   from /lib/libc.so.7
> (gdb) where
>
> #0  0x0000000800b54d4c in _umtx_op () from /lib/libc.so.7
> #1  0x00000008008e4079 in pthread_cleanup_push () from /lib/libthr.so.3
> #2  0x00000008008e2a65 in pthread_cond_init () from /lib/libthr.so.3
> #3  0x000000080063f8f6 in os_cond_timedwait (cond=0x864925f68,
>    mutex=0x864925f70, ms=0, nano=0)
>    at /home/harmony/harmony/working_vm/vm/thread/src/linux/os_condvar.c:42
> #4  0x000000080063e775 in condvar_wait_impl (cond=0x864925f68,
>    mutex=0x864925f70, ms=0, nano=0, interruptable=Variable "interruptable" is not available.
> )
>    at /home/harmony/harmony/working_vm/vm/thread/src/thread_native_condvar.c:54
> #5  0x000000080063e494 in sem_wait_impl (sem=0x864925f60, ms=0, nano=0,
>    interruptable=0)
>    at /home/harmony/harmony/working_vm/vm/thread/src/thread_native_semaphore.c:71
> #6  0x0000000801665d75 in finalizer_threads_init (java_vm=Variable "java_vm" is not available.
> )
>    at /home/harmony/harmony/working_vm/vm/vmcore/src/init/finalizer_thread.cpp:119
> #7  0x000000080167d7ae in JNI_CreateJavaVM (p_vm=0x7fffffffdce8,
>    p_jni_env=0x7fffffffdce0, args=Variable "args" is not available.
> )
>    at /home/harmony/harmony/working_vm/vm/vmcore/src/init/finalizer_thread.cpp:119
> #7  0x000000080167d7ae in JNI_CreateJavaVM (p_vm=0x7fffffffdce8,
>    p_jni_env=0x7fffffffdce0, args=Variable "args" is not available.
> )
>    at /home/harmony/harmony/working_vm/vm/vmcore/src/jni/jni.cpp:580
> #8  0x0000000000401f3b in invocation (portLibrary=0x7fffffffdef0, argc=7,
>    argv=0x7fffffffe678, handle=34365183488, version=65540,
>    ignoreUnrecognized=1 '\001', mainClass=0x7fffffffe8d2 "HelloWorld",
>    classArg=6,
>    propertiesFileName=0x801107930 "/home/harmony/harmony/target/hdk/jdk/jre/bin/default/harmonyvm.properties",
isStandaloneJar=0,
>    vmdllsubdir=0x7fffffffddb0 "default") at ../shared/main.c:672
> #9  0x00000000004015ca in gpProtectedMain (args=0x7fffffffdec0)
>    at ../shared/main.c:393
> #10 0x0000000000403d96 in main (argc=7, argv=0x7fffffffe678,
>    envp=0x7fffffffe6b8) at ../shared/cmain.c:140
>
> If I use /etc/libmap.conf to force the use of kse thread library[0]
> then get an undefined symbol - because libkse.so doesn't provide
> pthread_mutexattr_setpshared but apr assumes this is available[1].  If I
> put an '#if 0' around the call to this function - which is probably not
> a good idea really - then HelloWorld runs but hangs while shutting down
> the VM. gdb says:
>
> (gdb) info threads
>  3 Thread 0x801119400 (LWP 100066)  collector_destruct (gc=0x843207070)
>    at /home/harmony/harmony/working_vm/vm/gc_gen/src/thread/collector.cpp:220
> * 2 Thread 0x80111ac00 (LWP 100072)  0x00000008008f32bc in pthread_atfork ()
>   from /usr/lib/libkse.so.3
>  1 Thread 0x80111b000 (runnable)  0x00000008008ecd48 in pthread_kill ()
>   from /usr/lib/libkse.so.3
> (gdb) where
> #0  0x00000008008f32bc in pthread_atfork () from /usr/lib/libkse.so.3
> #1  0x00000008008e0fd0 in sigaltstack () from /usr/lib/libkse.so.3
> #2  0x00000008008ecb99 in pthread_kill () from /usr/lib/libkse.so.3
> #3  0x0000000000000000 in ?? ()
> Error accessing memory address 0x7fffffbff000: Bad address.
> (gdb) thread 1
> [Switching to thread 1 (Thread 0x80111b000 (runnable))]#0  0x00000008008ecd48 in pthread_kill
() from /usr/lib/libkse.so.3
> (gdb) where
> #0  0x00000008008ecd48 in pthread_kill () from /usr/lib/libkse.so.3
> #1  0x00000008008f0c08 in _pthread_cond_wait () from /usr/lib/libkse.so.3
> #2  0x00000008008f1050 in pthread_cond_wait () from /usr/lib/libkse.so.3
> #3  0x000000080063f8f6 in os_cond_timedwait (cond=0x843211d28,
>    mutex=0x843211d30, ms=0, nano=0)
>    at /home/harmony/harmony/working_vm/vm/thread/src/linux/os_condvar.c:42
> #4  0x000000080063e775 in condvar_wait_impl (cond=0x843211d28,
>    mutex=0x843211d30, ms=0, nano=0, interruptable=Variable "interruptable" is not available.
> )
>    at /home/harmony/harmony/working_vm/vm/thread/src/thread_native_condvar.c:54
> #5  0x000000080063e494 in sem_wait_impl (sem=0x843211d20, ms=0, nano=0,
>    interruptable=0)
>    at /home/harmony/harmony/working_vm/vm/thread/src/thread_native_semaphore.c:71
> #6  0x0000000843420339 in collector_thread_func (arg=Variable "arg" is not available.
> ) at gc_platform.h:109
> #7  0x000000080063f506 in hythread_wrapper_start_proc (arg=Variable "arg" is not available.
> )
>    at /home/harmony/harmony/working_vm/vm/thread/src/thread_native_basic.c:813
> #8  0x0000000800642a17 in thread_start_func (arg=0x843211ea0)
>    at /home/harmony/harmony/working_vm/vm/port/src/thread/linux/thread_os.c:106
> #9  0x00000008008e38e9 in pthread_create () from /usr/lib/libkse.so.3
> #10 0x0000000800b5db84 in makecontext () from /lib/libc.so.7
> #11 0x0000000000000000 in ?? ()
> #12 0x000000080111b000 in ?? ()
> #13 0x00000008006429c0 in port_thread_attach ()
>    at /home/harmony/harmony/working_vm/vm/port/src/thread/linux/thread_os.c:428
> #14 0x0000000000000000 in ?? ()
> #15 0x0000000000000000 in ?? ()
> #16 0x0000000000000000 in ?? ()
> Error accessing memory address 0x7fffff9fe000: Bad address.
> (gdb) thread 3
> [Switching to thread 3 (Thread 0x801119400 (LWP 100066))]#0  collector_destruct
>    (gc=0x843207070)
>    at /home/harmony/harmony/working_vm/vm/gc_gen/src/thread/collector.cpp:220
> 220       while(old_live_collector_num == live_collector_num)
> (gdb) where
> #0  collector_destruct (gc=0x843207070)
>    at /home/harmony/harmony/working_vm/vm/gc_gen/src/thread/collector.cpp:220
> #1  0x000000084342fed5 in gc_wrapup ()
>    at /home/harmony/harmony/working_vm/vm/gc_gen/src/common/gc_for_vm.cpp:151
> #2  0x000000080163645d in ~Global_Env (this=0x8011790e8)
>    at /home/harmony/harmony/working_vm/vm/vmcore/src/class_support/Environment.cpp:268
> #3  0x000000080167da60 in DestroyJavaVM (vm=0x801179098)
>    at /home/harmony/harmony/working_vm/vm/vmcore/src/jni/jni.cpp:1559
> #4  0x00000000004020d6 in invocation (portLibrary=0x7fffffffdef0, argc=7,
>    argv=0x7fffffffe678, handle=34365195776, version=65540,
>    ignoreUnrecognized=1 '\001', mainClass=0x7fffffffe8d2 "HelloWorld",
>    classArg=6,
>    propertiesFileName=0x80115d0c0 "/home/harmony/harmony/target/hdk/jdk/jre/bin/default/harmonyvm.properties",
isStandaloneJar=0,
>    vmdllsubdir=0x7fffffffddb0 "default") at ../shared/main.c:762
> #5  0x00000000004015ca in gpProtectedMain (args=0x7fffffffdec0)
>    at ../shared/main.c:393
> #6  0x0000000000403d96 in main (argc=7, argv=0x7fffffffe678,
>    envp=0x7fffffffe6b8) at ../shared/cmain.c:140
>
> All this is with -Xint.  Running without -Xint I get similar behaviour with kse.
> With libthr I get:
>
>  Internal error
>  java.lang.OutOfMemoryError: Failed to create new thread
>        at java.lang.Thread.start(Thread.java:755)
>        at java.lang.EMThreadSupport.initialize(EMThreadSupport.java:49)
>        at java.lang.VMStart.startHelperThreads(VMStart.java:75)
>        at java.lang.VMStart.initialize(VMStart.java:38)
>
> truss shows thr_new failing with ERR#1 'Operation not permitted'.
>
> On x86 the classlib portlib tests mostly work though the hymmap
> test fails at line 150 but I think this might be because the
> hysysinfo_get_executable_name function is broken.  I'll take a look at
> this.
>
> Not exactly sure how to make more progress but I'll sleep on it.  If anyone
> else has any ideas I'd love to hear them.
>
> -Mark.
>
> [0]
>  (echo "[$PWD/target/hdk/jdk/jre/bin/java]"; echo libthr.so.3 libkse.so.3 ) \
>     >>/etc/libmap.conf
>
> [1] apr's ./configure seems to check for pthread_mutexattr_setpshared
> and finds it because it is looking at libthr.so headers.  The resulting
> HAVE_PTHREAD_MUTEXATTR_SETPSHARED doesn't seem to be used at all let
> alone to protect the usage of this function.  I took a look at the
> locks/unix/proc_mutex.c in apr svn trunk and it appears to be the same
> so upgrading apr wouldn't help - though I'm tempted to try this to see
> if it helps when using libthr.so which does have pthread_mutexattr_setpshared.
>
>



-- 
http://xiao-feng.blogspot.com

Mime
View raw message