Bug 154215

Summary: [OOo][gcj] GThread-ERROR **: GThread system may be only initialized once
Product: [Fedora] Fedora Reporter: Caolan McNamara <caolanm>
Component: gccAssignee: Thomas Fitzsimmons <fitzsim>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: dcbw, rousseau
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-05-04 09:51:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 136450    
Attachments:
Description Flags
Don't call g_thread_init() when threading is already initialized. none

Description Caolan McNamara 2005-04-08 14:58:10 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050330

Description of problem:
GThread-ERROR **: GThread system may only be initialized once.
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread -1208370368 (LWP 14866)]
0x009d97e2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
(gdb) bt
#0  0x009d97e2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1  0x00a1e2dc in raise () from /lib/libc.so.6
#2  0x00a1fa28 in abort () from /lib/libc.so.6
#3  0x00c85383 in IA__g_logv (log_domain=Variable "log_domain" is not available.) at gmessages.c:492
#4  0x00c853b7 in IA__g_log (log_domain=0x0, log_level=0, format=0x0)
    at gmessages.c:512
#5  0x009af4cf in g_thread_init (init=0x0) at gthread-impl.c:321
#6  0x0384a17b in Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit ()
   from /usr/lib/lib-gnu-java-awt-peer-gtk.so.6
#7  0x03835f94 in gnu::java::awt::peer::gtk::GtkToolkit::gtkInit ()
   from /usr/lib/lib-gnu-java-awt-peer-gtk.so.6
#8  0x0383751e in gnu::java::awt::peer::gtk::GtkToolkit::__U3c_clinit__U3e_ ()
   from /usr/lib/lib-gnu-java-awt-peer-gtk.so.6
#9  0xb389636d in java::lang::Class::initializeClass ()
   from /usr/lib/libgcj.so.6
#10 0xb38965f1 in java::lang::Class::forName () from /usr/lib/libgcj.so.6
#11 0xb389665e in java::lang::Class::forName () from /usr/lib/libgcj.so.6
#12 0xb3a39ae9 in java::awt::Toolkit::getDefaultToolkit ()
   from /usr/lib/libgcj.so.6
#13 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/libgcj.so.6
#14 0xb3bd05c9 in ffi_raw_call () from /usr/lib/libgcj.so.6
#15 0xb387730e in _Jv_InterpMethod::run () from /usr/lib/libgcj.so.6
#16 0xb387ab58 in _Jv_InterpMethod::run_class () from /usr/lib/libgcj.so.6
#17 0xb3bd047c in ffi_prep_closure () from /usr/lib/libgcj.so.6
#18 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/libgcj.so.6
#19 0xb3bd02d6 in ffi_call () from /usr/lib/libgcj.so.6
#20 0xb38a141e in _Jv_CallAnyMethodA () from /usr/lib/libgcj.so.6
#21 0xb38a197a in _Jv_CallAnyMethodA () from /usr/lib/libgcj.so.6
#22 0xb38a1def in java::lang::reflect::Method::invoke ()
   from /usr/lib/libgcj.so.6
#23 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/libgcj.so.6
#24 0xb3bd05c9 in ffi_raw_call () from /usr/lib/libgcj.so.6
#25 0xb387730e in _Jv_InterpMethod::run () from /usr/lib/libgcj.so.6
#26 0xb387abef in _Jv_InterpMethod::run_normal () from /usr/lib/libgcj.so.6
#27 0xb3bd047c in ffi_prep_closure () from /usr/lib/libgcj.so.6
#28 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/libgcj.so.6
#29 0xb3bd02d6 in ffi_call () from /usr/lib/libgcj.so.6
#30 0xb38a141e in _Jv_CallAnyMethodA () from /usr/lib/libgcj.so.6
#31 0xb3868604 in JNI_GetCreatedJavaVMs () from /usr/lib/libgcj.so.6
#32 0x0761eb76 in Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize
    () from /usr/lib/openoffice.org1.9.89/program/libjava_uno.so
#33 0x0761fdc0 in Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize
    () from /usr/lib/openoffice.org1.9.89/program/libjava_uno.so
#34 0x07620410 in Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize
    () from /usr/lib/openoffice.org1.9.89/program/libjava_uno.so
#35 0x06e60774 in ?? ()
   from /usr/lib/openoffice.org1.9.89/program/libgcc3_uno.so
#36 0x06e60bab in ?? ()
   from /usr/lib/openoffice.org1.9.89/program/libgcc3_uno.so
#37 0x06e61686 in ?? ()
   from /usr/lib/openoffice.org1.9.89/program/libgcc3_uno.so
#38 0x0143b962 in component_getFactory ()
   from /usr/lib/openoffice.org1.9.89/program/javaloader.uno.so
#39 0x007a0ba8 in cppu::createFactoryProxy ()
   from /usr/lib/openoffice.org1.9.89/program/libuno_cppuhelpergcc3.so.3
#40 0x007a0d37 in cppu::createFactoryProxy ()
   from /usr/lib/openoffice.org1.9.89/program/libuno_cppuhelpergcc3.so.3
#41 0x0067648b in component_getFactory ()
   from /usr/lib/openoffice.org1.9.89/program/servicemgr.uno.so
#42 0x00675e6c in component_getFactory ()
   from /usr/lib/openoffice.org1.9.89/program/servicemgr.uno.so
#43 0x0208b512 in ImplGetResMgr ()
   from /usr/lib/openoffice.org1.9.89/program/libvcl680li.so
#44 0x02087e74 in InitAccessBridge ()
   from /usr/lib/openoffice.org1.9.89/program/libvcl680li.so
#45 0x08065786 in desktop::Desktop::Main ()
#46 0x0208d54f in SVMain ()
   from /usr/lib/openoffice.org1.9.89/program/libvcl680li.so
#47 0x08061916 in sal_main ()
#48 0x00a0ade6 in __libc_start_main () from /lib/libc.so.6
#49 0x0806185d in _start ()


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Start OpenOffice.org 1.9.89-5 with gconf key desktop/gnome/interface_accessibility enabled which will attempt to launch the java accessibility bridge.

Actual Results:  crash

Expected Results:  at least nocrash

Additional info:

Comment 1 Caolan McNamara 2005-04-08 14:59:10 UTC
with libgcj from gcc-4.0.0-40.

Comment 2 Dan Williams 2005-04-08 16:01:22 UTC
fitzsim:

gcj should be using something like this to make sure that threading is only
initialized once:

if (!g_thread_supported())
    g_thread_init (NULL);

g_thread_supported() will indicate whether or not the thread system has been
initialized already.

Patch attached.

Comment 3 Dan Williams 2005-04-08 16:03:46 UTC
Created attachment 112861 [details]
Don't call g_thread_init() when threading is already initialized.

Note that there are some potential problems here.  For instance, when OOo has
already called g_thread_init() with NULL, I don't believe you can replace the
current glib threading implementation with portable_native_sync_jni_functions. 
I'm fairly sure that g_thread_init() is one-shot.  So you'll have to deal with
not being able to use portable_native_sync_jni_functions all the time.

Comment 4 Dan Williams 2005-04-08 16:22:02 UTC
(12:09:52) dcbw: owen: But there is one case where gcj wants to replace the
default thread stuff with its own, which it would not be able to do if OOo
already initialized threads with g_thread_init (NULL);
(12:09:57) dcbw: owen: correct?
(12:09:59) owen: dcbw: gcj should stop doing that
(12:10:16) owen: We're likely to deprecate the functionality at some point
(12:11:51) dcbw: owen: gcj seems to map the glib threading functions to its own
JNI threading/mutex functions in that instance
(12:12:11) owen: dcbw: Bad idea
(12:12:33) dcbw: owen: What should they do instead?
(12:12:47) owen: dcbw: gcj needs to be using threading/mutex functions that are
cfompatible with the native system ones

Comment 5 Thomas Fitzsimmons 2005-04-15 21:55:11 UTC
We don't use the portable native sync functions in libgcj.  They were added to
GNU Classpath to support VMs that don't use the platform's native threading
model.  I suppose the portable native sync functions will never be usable in GTK
apps that embed a JVM in-process.  I'll post your patch to the GNU Classpath
list for discussion.  In the meantime, I'll test it and send it to Jakub for
inclusion in our libgcj RPMs.


Comment 6 Thomas Fitzsimmons 2005-04-19 18:22:49 UTC
I can't reproduce this in openoffice.org-writer-1.9.92-2
openoffice.org-core-1.9.92-2.  I enabled the gconf key:

desktop->gnome->interface->accessibility

and then ran "ooffice".  What else do I need to do?  Is there a workaround patch
in the rpms that I need to disable?


Comment 7 Caolan McNamara 2005-04-20 07:29:38 UTC
It's there with gcc-4.0.0-40 and now gone in gcc-4.0.0-42. I'm not certain if
that is actually a "fixed with gcc-4.0.0-42" seeing as there are other problems
with gcj in -42. Might be best to wait until > 42 and reconfirm that crash is
begone.

Comment 8 Caolan McNamara 2005-04-25 09:40:02 UTC
reproducable at runtime with 1.9.92 and gcc-4.0.0-1 (not 1.9.93 because that has
had its java disabled due to problems with gcc-4.0.0-0.42 with which it was built)

Comment 9 Thomas Fitzsimmons 2005-04-27 21:10:36 UTC
I've sent the patch here to Jakub for inclusion in the FC4 libgcj RPMs.  I'll
keep you posted as to when it's ready to be tested.


Comment 10 Jakub Jelinek 2005-05-02 09:51:52 UTC
That patch is in gcc-4.0.0-2.  Please verify.

Comment 11 Caolan McNamara 2005-05-04 09:51:26 UTC
OOo starts without error when accessibility flag enabled. Good enough for me.