Bug 96105 - [GTK] calling webkitInit() from class_init() functions can cause deadlocks
Summary: [GTK] calling webkitInit() from class_init() functions can cause deadlocks
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-07 07:25 PDT by Dan Winship
Modified: 2014-04-08 19:01 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Winship 2012-09-07 07:25:11 PDT
See, eg, https://bugzilla.gnome.org/page.cgi?id=trace.html&trace_id=230816 from https://bugzilla.gnome.org/show_bug.cgi?id=683548. This is caused because webkit_web_view_class_init() calls webkitInit(), and webkitInit() creates objects, which (apparently) you aren't supposed to do from inside a class_init() function.

In particular, gtype's class_init_rec_mutex is held during the class_init function, and so if you do things in your class_init that might grab other mutexes, then there's the possibility that another thread might grab those mutexes in the other order and deadlock. (In that stack trace, webkit_web_view_class_init() calls webkitInit(), which creates the default session, which ends up trying to grab default_modules_lock so it can load the default GProxyResolver plugin, but meanwhile another thread is loading the GTlsBackend plugin, which then tries to register classes...)

It's possible that class_init_rec_mutex might go away at some point (bgo 674885), but for now, it's there, and deadlocks can happen as a result.


I didn't look at webkitInit() in detail, but if you could call it from instance init functions instead of class init functions, that would fix things.
Comment 1 Martin Robinson 2014-04-08 19:01:42 PDT
The GTK+ port of WebKit1 has been removed.