Firefox hang on start because ibus calls g_object_new inside a class_init function
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GLib |
Expired
|
Medium
|
|||
glib2.0 (Ubuntu) |
Triaged
|
High
|
Unassigned |
Bug Description
There's an unusually large number of reports about Firefox not starting at all for some users on raring. I'm not sure if this is the same issue, but I've just hit the same deadlock when starting Firefox twice in 30 minutes on a fresh raring VM.
Here's a stack trace of the 2 most interesting threads:
Thread 2 (Thread 0x7fb4b73af700 (LWP 21183)):
#0 0x00007fb4ca42982c in __lll_lock_wait () from /lib/x86_
#1 0x00007fb4ca425197 in _L_lock_1035 () from /lib/x86_
#2 0x00007fb4ca425029 in pthread_mutex_lock () from /lib/x86_
#3 0x00007fb4c4e41506 in g_type_class_ref (type=type@
at /build/
#4 0x00007fb4c4e2a281 in g_object_newv (object_
n_parameter
at /build/
#5 0x00007fb4c4e2a81c in g_object_new (object_
first_
at /build/
#6 0x00007fb4c2c055e9 in g_cancellable_new () at /build/
#7 0x00007fb4c2ca01d1 in _g_dbus_worker_new (stream=
capabilitie
message_
message_
disconnecte
user_
#8 0x00007fb4c2c93e07 in initable_init (initable=
error=
#9 0x00007fb4c2c01e41 in async_init_thread (task=0x7fb4c9d
task_
at /build/
#10 0x00007fb4c2c4d835 in g_task_
pool_
#11 0x00007fb4c4b846f2 in g_thread_
---Type <return> to continue, or q <return> to quit---
at /build/
#12 0x00007fb4c4b83eb5 in g_thread_proxy (data=0x7fb4b88
at /build/
#13 0x00007fb4ca422f8e in start_thread () from /lib/x86_
#14 0x00007fb4ca14ce1d in clone () from /lib/x86_
Thread 1 (Thread 0x7fb4cb04b740 (LWP 21176)):
#0 0x00007fb4ca42982c in __lll_lock_wait () from /lib/x86_
#1 0x00007fb4ca4251b2 in _L_lock_1142 () from /lib/x86_
#2 0x00007fb4ca425130 in pthread_mutex_lock () from /lib/x86_
#3 0x00007fb4c4b9f5c1 in g_mutex_lock (mutex=
at /build/
#4 0x00007fb4c2c93c3d in initable_init (initable=
at /build/
#5 0x00007fb4c2c945d1 in g_bus_get_sync (bus_type=
cancellable
at /build/
#6 0x00007fb4b5db24f8 in g_daemon_vfs_init (vfs=0x7fb4b924
#7 0x00007fb4c4e4395f in g_type_
at /build/
#8 0x00007fb4c4e28718 in g_object_
construct_
#9 0x00007fb4c4e2a1d1 in g_object_newv (object_
n_parameter
at /build/
#10 0x00007fb4c4e2a81c in g_object_new (object_
first_
at /build/
#11 0x00007fb4c2c2c311 in try_implementation (extension=
verify_
at /build/
#12 0x00007fb4c2c2c4c0 in _g_io_module_
extension_
envvar=
verify_
at /build/
#13 0x00007fb4c2c57a8e in g_vfs_get_default () at /build/
#14 0x00007fb4c2c18ede in g_file_new_for_path (
---Type <return> to continue, or q <return> to quit---
path=
at /build/
#15 0x00007fb4b657ddda in ibus_bus_init (bus=0x7fb4b88e
#16 0x00007fb4c4e4395f in g_type_
at /build/
#17 0x00007fb4c4e28718 in g_object_
construct_
#18 0x00007fb4b657bd75 in ibus_bus_
type=
#19 ibus_bus_
#20 0x00007fb4c4e2a1d1 in g_object_newv (object_
n_parameter
at /build/
#21 0x00007fb4c4e2a81c in g_object_new (object_
first_
at /build/
#22 0x00007fb4b657bdca in ibus_bus_new () at ibusbus.c:487
#23 0x00007fb4b67a810a in ibus_im_
#24 0x00007fb4c4e41956 in type_class_init_Wm (pclass=
at /build/
#25 g_type_class_ref (type=type@
at /build/
#26 0x00007fb4c4e2a281 in g_object_newv (object_
n_parameter
at /build/
#27 0x00007fb4c4e2a81c in g_object_new (object_
at /build/
#28 0x00007fb4b67a8bc2 in ibus_im_context_new ()
from /usr/lib/
#29 0x00007fb4c32693f6 in _gtk_im_
at /build/
#30 0x00007fb4c3269cd9 in gtk_im_
at /build/
#31 0x00007fb4c3269f7d in gtk_im_
window=
#32 0x00007fb4c320efda in gtk_entry_realize (widget=
at /build/
#33 0x00007fb4c4e23620 in g_closure_invoke (closure=
---Type <return> to continue, or q <return> to quit---
param_
at /build/
#34 0x00007fb4c4e34544 in signal_
detail=
emission_
instance_
at /build/
#35 0x00007fb4c4e3cd11 in g_signal_
detail=0, var_args=
at /build/
#36 0x00007fb4c4e3cf92 in g_signal_emit (instance=
signal_
at /build/
#37 0x00007fb4c33a1a00 in IA__gtk_
at /build/
#38 0x00007fb4c6a726ce in nsLookAndFeel:
at /build/
#39 0x00007fb4c6a8be24 in GetInstance ()
at /build/
#40 nsXPLookAndFeel
at /build/
#41 0x00007fb4c6a8c5e8 in mozilla:
aID=
at /build/
#42 0x00007fb4c6d036f2 in GetInt (aDefault=0, aID=mozilla:
at ../../dist/
#43 nsChromeRegistr
at /build/
#44 0x00007fb4c60ee064 in ScopedXPCOMStar
native=
#45 0x00007fb4c60f08fd in XREMain:
at /build/
#46 0x00007fb4c60f31f0 in XREMain::XRE_main (this=this@
argv=
at /build/
#47 0x00007fb4c60f3442 in XRE_main (argc=2, argv=0x7fff170d
aFlags=
#48 0x00007fb4cb06c075 in do_main (argc=argc@entry=2, argv=argv@
---Type <return> to continue, or q <return> to quit---
0x7fb4c9d2a540) at /build/
#49 0x00007fb4cb06b833 in main (argc=2, argv=0x7fff170d
at /build/
From first glance, it looks like this has happened:
- Someone in the past has called g_bus_get on the main thread.
- GDBusConnection's initable_init() starts running on a separate thread.
- Someone then calls g_bus_get_sync on the main thread using the same bus, which causes GDBusConnection's initable_init() to run on the main thread.
- initable_init() waits on the main thread because the second thread has the lock (connection-
- The second thread waits inside g_type_class_ref() because the main thread has this lock, which is waiting on the second thread to release another lock.
....Deadlock!
The issue seems to be that ibus_im_
affects: | glib2.0 (Ubuntu) → ibus (Ubuntu) |
Changed in ibus (Ubuntu): | |
importance: | Undecided → High |
status: | New → Triaged |
Changed in glib: | |
importance: | Unknown → Medium |
status: | Unknown → Confirmed |
Changed in glib: | |
status: | Confirmed → In Progress |
Changed in glib: | |
status: | In Progress → Expired |
Note, from IRC:
<chrisccoulson> desrt, is it a bug to call g_object_new from within a class_init function? /launchpad. net/bugs/ 1179554
<desrt> yesish
<chrisccoulson> desrt, heh, i thought as much (see bug 1179554) ;)
<ubot2> Launchpad bug 1179554 in ibus (Ubuntu) "Firefox hang on start because ibus calls g_object_new inside a class_init function" [High,Triaged] https:/
<desrt> it's not strictly a bug
but you should only be doing a very limited number of things in class_init
properties, signals, vfunc overrides