Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 154215 - [OOo][gcj] GThread-ERROR **: GThread system may be only initialized once
Summary: [OOo][gcj] GThread-ERROR **: GThread system may be only initialized once
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: rawhide
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Thomas Fitzsimmons
QA Contact:
Depends On:
Blocks: FC4Blocker
TreeView+ depends on / blocked
Reported: 2005-04-08 14:58 UTC by Caolan McNamara
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-05-04 09:51:26 UTC

Attachments (Terms of Use)
Don't call g_thread_init() when threading is already initialized. (deleted)
2005-04-08 16:03 UTC, Dan Williams
no flags Details | Diff

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.

Program received signal SIGABRT, Aborted.
[Switching to Thread -1208370368 (LWP 14866)]
0x009d97e2 in _dl_sysinfo_int80 () from /lib/
(gdb) bt
#0  0x009d97e2 in _dl_sysinfo_int80 () from /lib/
#1  0x00a1e2dc in raise () from /lib/
#2  0x00a1fa28 in abort () from /lib/
#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/
#7  0x03835f94 in gnu::java::awt::peer::gtk::GtkToolkit::gtkInit ()
   from /usr/lib/
#8  0x0383751e in gnu::java::awt::peer::gtk::GtkToolkit::__U3c_clinit__U3e_ ()
   from /usr/lib/
#9  0xb389636d in java::lang::Class::initializeClass ()
   from /usr/lib/
#10 0xb38965f1 in java::lang::Class::forName () from /usr/lib/
#11 0xb389665e in java::lang::Class::forName () from /usr/lib/
#12 0xb3a39ae9 in java::awt::Toolkit::getDefaultToolkit ()
   from /usr/lib/
#13 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/
#14 0xb3bd05c9 in ffi_raw_call () from /usr/lib/
#15 0xb387730e in _Jv_InterpMethod::run () from /usr/lib/
#16 0xb387ab58 in _Jv_InterpMethod::run_class () from /usr/lib/
#17 0xb3bd047c in ffi_prep_closure () from /usr/lib/
#18 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/
#19 0xb3bd02d6 in ffi_call () from /usr/lib/
#20 0xb38a141e in _Jv_CallAnyMethodA () from /usr/lib/
#21 0xb38a197a in _Jv_CallAnyMethodA () from /usr/lib/
#22 0xb38a1def in java::lang::reflect::Method::invoke ()
   from /usr/lib/
#23 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/
#24 0xb3bd05c9 in ffi_raw_call () from /usr/lib/
#25 0xb387730e in _Jv_InterpMethod::run () from /usr/lib/
#26 0xb387abef in _Jv_InterpMethod::run_normal () from /usr/lib/
#27 0xb3bd047c in ffi_prep_closure () from /usr/lib/
#28 0xb3bd0607 in ffi_call_SYSV () from /usr/lib/
#29 0xb3bd02d6 in ffi_call () from /usr/lib/
#30 0xb38a141e in _Jv_CallAnyMethodA () from /usr/lib/
#31 0xb3868604 in JNI_GetCreatedJavaVMs () from /usr/lib/
#32 0x0761eb76 in Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize
    () from /usr/lib/openoffice.org1.9.89/program/
#33 0x0761fdc0 in Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize
    () from /usr/lib/openoffice.org1.9.89/program/
#34 0x07620410 in Java_com_sun_star_bridges_jni_1uno_JNI_1info_1holder_finalize
    () from /usr/lib/openoffice.org1.9.89/program/
#35 0x06e60774 in ?? ()
   from /usr/lib/openoffice.org1.9.89/program/
#36 0x06e60bab in ?? ()
   from /usr/lib/openoffice.org1.9.89/program/
#37 0x06e61686 in ?? ()
   from /usr/lib/openoffice.org1.9.89/program/
#38 0x0143b962 in component_getFactory ()
   from /usr/lib/openoffice.org1.9.89/program/
#39 0x007a0ba8 in cppu::createFactoryProxy ()
   from /usr/lib/openoffice.org1.9.89/program/
#40 0x007a0d37 in cppu::createFactoryProxy ()
   from /usr/lib/openoffice.org1.9.89/program/
#41 0x0067648b in component_getFactory ()
   from /usr/lib/openoffice.org1.9.89/program/
#42 0x00675e6c in component_getFactory ()
   from /usr/lib/openoffice.org1.9.89/program/
#43 0x0208b512 in ImplGetResMgr ()
   from /usr/lib/openoffice.org1.9.89/program/
#44 0x02087e74 in InitAccessBridge ()
   from /usr/lib/openoffice.org1.9.89/program/
#45 0x08065786 in desktop::Desktop::Main ()
#46 0x0208d54f in SVMain ()
   from /usr/lib/openoffice.org1.9.89/program/
#47 0x08061916 in sal_main ()
#48 0x00a0ade6 in __libc_start_main () from /lib/
#49 0x0806185d in _start ()

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

How reproducible:

Steps to Reproduce:
1. Start 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

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  I enabled the gconf key:


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

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.

Note You need to log in before you can comment on or make changes to this bug.