After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750163 - Crash in sqlite3_initialize (deep in WebKit)
Crash in sqlite3_initialize (deep in WebKit)
Status: RESOLVED FIXED
Product: gnome-builder
Classification: Other
Component: general
3.16.x
Other Linux
: Normal critical
: ---
Assigned To: GNOME Builder Maintainers
GNOME Builder Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-05-31 02:00 UTC by Michael Catanzaro
Modified: 2015-06-02 18:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
webkit: disable unneeded WebKit features (5.77 KB, patch)
2015-05-31 14:39 UTC, Michael Catanzaro
none Details | Review
webkit: disable unneeded WebKit features (5.82 KB, patch)
2015-05-31 14:43 UTC, Michael Catanzaro
none Details | Review
webkit: disable unneeded WebKit features (5.83 KB, patch)
2015-06-01 03:07 UTC, Michael Catanzaro
committed Details | Review

Description Michael Catanzaro 2015-05-31 02:00:30 UTC
GNOME Builder occasionally crashes deep in WebKit:

Truncated backtrace:
Thread no. 1 (10 frames)
 #1 sqlite3_initialize at sqlite3.c:127696
 #2 openDatabase at sqlite3.c:130186
 #3 WebCore::SQLiteFileSystem::openDatabase at /usr/src/debug/webkitgtk-2.8.1/Source/WebCore/platform/sql/SQLiteFileSystem.cpp:53
 #4 WebCore::SQLiteDatabase::open at /usr/src/debug/webkitgtk-2.8.1/Source/WebCore/platform/sql/SQLiteDatabase.cpp:75
 #5 WebKit::LocalStorageDatabaseTracker::openTrackerDatabase at /usr/src/debug/webkitgtk-2.8.1/Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.cpp:224
 #6 WebKit::LocalStorageDatabaseTracker::importOriginIdentifiers at /usr/src/debug/webkitgtk-2.8.1/Source/WebKit2/UIProcess/Storage/LocalStorageDatabaseTracker.cpp:242
 #7 operator() at /usr/include/c++/5.0.0/functional:2271
 #8 WTF::GMainLoopSource::voidCallback at /usr/src/debug/webkitgtk-2.8.1/Source/WTF/wtf/gobject/GMainLoopSource.cpp:365
 #9 WTF::GMainLoopSource::voidSourceCallback at /usr/src/debug/webkitgtk-2.8.1/Source/WTF/wtf/gobject/GMainLoopSource.cpp:456
 #14 operator() at /usr/include/c++/5.0.0/functional:2271

It's crashing when opening the HTML5 local storage database. I'm not really sure why that's handled by the UI process instead of the web process or the database process, but whatever. I think Builder should just disable local storage, plus a few more things you don't need for showing static HTML files, as we've done in devhelp. The list of settings I'd disable is:

enable-html5-database
enable-html5-local-storage
enable-javascript
enable-plugins

For example, see this devhelp commit: https://git.gnome.org/browse/devhelp/commit/?id=55e425cbd224e10dd586518863e81281b2de5690

Check the See Also field for the full backtrace in the Red Hat bug.
Comment 1 Michael Catanzaro 2015-05-31 14:39:56 UTC
Created attachment 304321 [details] [review]
webkit: disable unneeded WebKit features

This is partially a workaround for WebKit bug #143245, where the
inspector process pool and default process pool (the default web
context) access the HTML5 local storage database at the same time from
different threads. In theory, that's an SQLite bug, but it doesn't
really matter because GNOME Builder is not a web browser and it doesn't
need HTML5 local storage. Let's avoid the issue altogether by disabling
it entirelly, as well as some other features we probably don't need,
like Javascript and NPAPI plugins.

This probably won't stop Builder from accessing the local storage
database altogether, because it won't affect the inspector web context,
but now it should only happen from one thread at a time. WebKit master
is smart enough to not create the inspector web context unless it's
actually needed, so going forward that shouldn't be an issue anymore
(since Builder does not enable the web inspector).

Note: it would probably be a bit better to disable these settings before
creating the web view, rather than after. But I'm not sure how to do
that with the web views living in .ui files, and they seem happy there.
There might be a teensy race left open, but it's a WebKit or SQLite bug
rather than a Builder bug, and nobody will ever hit it, knock on wood.
Comment 2 Michael Catanzaro 2015-05-31 14:43:25 UTC
Created attachment 304322 [details] [review]
webkit: disable unneeded WebKit features

Somehow tricked myself into thinking that GbHtmlView has only one web view....
Comment 3 Christian Hergert 2015-05-31 19:55:31 UTC
Review of attachment 304322 [details] [review]:

LGTM once we've clarified the JS situation.

::: src/util/gb-webkit.c
@@ +26,3 @@
+                "enable-html5-database", FALSE,
+                "enable-html5-local-storage", FALSE,
+                "enable-javascript", FALSE,

I'm not sure we can disable javascript. We do use that for the markdown editor pretty heavily. Other than that, looks good.

Long term though, we will probably need this fixed. As we get "real" HTML editing facilities, people will want to be able to test things.
Comment 4 Michael Catanzaro 2015-05-31 22:33:16 UTC
Sure, no harm in leaving js enabled, I just incorrectly assumed it was not used.

(In reply to Christian Hergert from comment #3)
> Long term though, we will probably need this fixed. As we get "real" HTML
> editing facilities, people will want to be able to test things.

Ah, so you want to be able to prototype a complex web sites within Builder? I hadn't considered that; I was assuming these were features that you would never want. In that case, perhaps we should disable only local storage and only temporarily, with a FIXME to remove the code once the WebKit/SQLite bug is fixed?
Comment 5 Christian Hergert 2015-05-31 22:47:30 UTC
That sounds good to me.
Comment 6 Michael Catanzaro 2015-06-01 03:07:49 UTC
Created attachment 304338 [details] [review]
webkit: disable unneeded WebKit features

This is partially a workaround for WebKit bug #143245, where the
inspector process pool and default process pool (the default web
context) access the HTML5 local storage database at the same time from
different threads. In theory, that's an SQLite bug, but it doesn't
really matter because GNOME Builder is not a web browser and it doesn't
need HTML5 local storage. Let's avoid the issue altogether by disabling
it.

This probably won't stop Builder from accessing the local storage
database altogether, because it won't affect the inspector web context,
but now it should only happen from one thread at a time. WebKit master
is smart enough to not create the inspector web context unless it's
actually needed, so going forward that shouldn't be an issue anymore
(since Builder does not enable the web inspector).

Note: it would probably be a bit better to disable these settings before
creating the web view, rather than after. But I'm not sure how to do
that with the web views living in .ui files, and they seem happy there.
There might be a teensy race left open, but it's a WebKit or SQLite bug
rather than a Builder bug, and nobody will ever hit it, knock on wood.
Comment 7 Christian Hergert 2015-06-01 04:01:41 UTC
Review of attachment 304338 [details] [review]:

LGTM
Comment 8 Michael Catanzaro 2015-06-01 11:58:41 UTC
Attachment 304338 [details] pushed as 0067e07 - webkit: disable unneeded WebKit features
Comment 9 Michael Catanzaro 2015-06-02 18:05:23 UTC
Hm, I hit this today even with local storage turned off... wonderful.