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 696020 - [WK2] When ran to open an URI in an existing instance, creates a WebProcess which then crashes because the UI process is gone
[WK2] When ran to open an URI in an existing instance, creates a WebProcess w...
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Backend
git master
Other Linux
: Normal normal
: ---
Assigned To: Xan Lopez
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-03-18 01:33 UTC by Gustavo Noronha (kov)
Modified: 2013-08-01 13:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (5.99 KB, patch)
2013-03-19 18:06 UTC, Carlos Garcia Campos
reviewed Details | Review
Unify all web context setup in EphyEmbedShell on primary instance startup (12.00 KB, patch)
2013-03-28 15:03 UTC, Carlos Garcia Campos
committed Details | Review

Description Gustavo Noronha (kov) 2013-03-18 01:33:38 UTC
I added the core dumps trick that's used in the (Igalia) WebKit buildbots to my machine, and I use a very simple script to notify me of crashes. I noticed a notification for the WebProcess crashing happened a lot, and I nailed it down to the condition described in the summary.

The problem is we delay noticing we're just trying to open a link in an existing instance for quite a bit, and a *lot* of stuff is initialized as if we were going to run a full instance. The creation of the WebProcess is triggered by that, but we then notice the existing instance, tell it to do stuff over D-Bus and exit - the WebProcess tries to create the socket for the specified fd and crashes with a g_error. The one that triggers the WebProcess creation is EphyEmbedPrefs:

Breakpoint 3, WorkQueue::dispatch(WTF::Function<void ()> const&) (this=0x5982e0, function=...) at ../src/StableWebKit/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp:202
202         GRefPtr<GSource> dispatchSource = adoptGRef(g_idle_source_new());
(gdb) bt
  • #0 WorkQueue::dispatch(WTF::Function<void ()> const&)
    at ../src/StableWebKit/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp line 202
  • #1 WebKit::ProcessLauncher::ProcessLauncher
    at ../src/StableWebKit/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.cpp line 47
  • #2 WebKit::ProcessLauncher::create
    at ../src/StableWebKit/Source/WebKit2/UIProcess/Launcher/ProcessLauncher.h line 81
  • #3 WebKit::ChildProcessProxy::connect
    at ../src/StableWebKit/Source/WebKit2/Shared/ChildProcessProxy.cpp line 65
  • #4 WebKit::WebProcessProxy::WebProcessProxy
    at ../src/StableWebKit/Source/WebKit2/UIProcess/WebProcessProxy.cpp line 101
  • #5 WebKit::WebProcessProxy::create
    at ../src/StableWebKit/Source/WebKit2/UIProcess/WebProcessProxy.cpp line 87
  • #6 WebKit::WebContext::createNewWebProcess
    at ../src/StableWebKit/Source/WebKit2/UIProcess/WebContext.cpp line 459
  • #7 WebKit::WebContext::ensureSharedWebProcess
    at ../src/StableWebKit/Source/WebKit2/UIProcess/WebContext.cpp line 448
  • #8 WebKit::WebContext::sendToNetworkingProcessRelaunchingIfNecessary<Messages::WebCookieManager::StartObservingCookieChanges>
    at ../src/StableWebKit/Source/WebKit2/UIProcess/WebContext.h line 497
  • #9 WebKit::WebCookieManagerProxy::startObservingCookieChanges
    at ../src/StableWebKit/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp line 139
  • #10 webkitCookieManagerCreate
    at ../src/StableWebKit/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp line 109
  • #11 webkit_web_context_get_cookie_manager
    at ../src/StableWebKit/Source/WebKit2/UIProcess/API/gtk/WebKitWebContext.cpp line 359
  • #12 webkit_pref_callback_cookie_accept_policy
    at ../../embed/ephy-embed-prefs.c line 487
  • #13 ephy_embed_prefs_init
    at ../../embed/ephy-embed-prefs.c line 710
  • #14 main
    at ../../src/ephy-main.c line 486

I think we can do something on the WebProcess to make make this situation not critical (by making it not crash if the fd disappeared), but I think we could also improve epiphany to notice we should just send a D-Bus message earlier, too. Opinions?
Comment 1 Gustavo Noronha (kov) 2013-03-18 01:37:34 UTC
This is the error that Epiphany prints, btw:

(WebKitWebProcess:16101): GLib-GIO-ERROR **: creating GSocket from fd 11: Bad file descriptor
Comment 2 Carlos Garcia Campos 2013-03-18 16:26:42 UTC
Yes, I've seen this before sometimes for wk2 unit tests that run very fast, the ui process is gone when the web process is creating the socket. So, I agree that this can be improved in webkit, but we can also try to make ephy a bit smarter, I guess.
Comment 3 Carlos Garcia Campos 2013-03-18 16:40:08 UTC
Maybe we can just init the prefs and all other stuff related to the web process that we are setting in ephy-main right before the prefs_init in ephy_shell_startup.
Comment 4 Carlos Garcia Campos 2013-03-19 18:06:08 UTC
Created attachment 239280 [details] [review]
Patch
Comment 5 Gustavo Noronha (kov) 2013-03-19 18:11:36 UTC
Works nicely, for me =)
Comment 6 Xan Lopez 2013-03-20 07:58:50 UTC
Review of attachment 239280 [details] [review]:

::: src/ephy-shell.c
@@ +261,3 @@
+  webkit_web_context_set_disk_cache_directory (webkit_web_context_get_default (),
+                                               disk_cache_dir);
+  g_free (disk_cache_dir);

I'd say we have the opportunity to make this a bit cleaner now. The cache dir and extensions dir settings should probably go inside ephy_embed_prefs_init(), right?

And for bonus points you could dump all the env vars into ephy_shell_set_environment () or something like that.
Comment 7 Carlos Garcia Campos 2013-03-20 08:19:07 UTC
(In reply to comment #6)
> Review of attachment 239280 [details] [review]:
> 
> ::: src/ephy-shell.c
> @@ +261,3 @@
> +  webkit_web_context_set_disk_cache_directory (webkit_web_context_get_default
> (),
> +                                               disk_cache_dir);
> +  g_free (disk_cache_dir);
> 
> I'd say we have the opportunity to make this a bit cleaner now. The cache dir
> and extensions dir settings should probably go inside ephy_embed_prefs_init(),
> right?

I don't think so, they are not settings. They will be moved to where WebKitWebContext are created when we support multiple web processes. Since we only support one in this moment, I would leave it here. I could use a helper function for this too, though, something like ephy_shell_setup_default_web_context() or something similar.

> And for bonus points you could dump all the env vars into
> ephy_shell_set_environment () or something like that.

Yes, I thought about it indeed, but in the end decided to just move the code. I'll do it.
Comment 8 Carlos Garcia Campos 2013-03-20 14:51:01 UTC
Pushed an updated patch.
Comment 9 Carlos Garcia Campos 2013-03-28 15:02:10 UTC
Reopening, since there's code in ephy_embed_init() that could spawn a web process.
Comment 10 Carlos Garcia Campos 2013-03-28 15:03:18 UTC
Created attachment 240061 [details] [review]
Unify all web context setup in EphyEmbedShell on primary instance startup
Comment 11 Xan Lopez 2013-04-01 09:02:38 UTC
Review of attachment 240061 [details] [review]:

OK, makes sense. Push to both branches.
Comment 12 Carlos Garcia Campos 2013-04-05 09:47:33 UTC
Pushed to master, will push to the stable branch after fixing all the conflicts due to the #ifdefs
Comment 13 Carlos Garcia Campos 2013-04-05 09:50:08 UTC
This might fix bug #666326.
Comment 14 Carlos Garcia Campos 2013-04-05 10:50:49 UTC
hmm, we don't really need this in the stable branch. This is a problem in master (see bug #666326) because of the ephy embed single removal. In the stable branch, initialization happens in ephy_embed_single_intialize() that is always called after the ephy_shell_startup().
Comment 15 Claudio Saavedra 2013-08-01 12:22:01 UTC
So what is exactly missing here? And what's the status of the attached patches?
Comment 16 Carlos Garcia Campos 2013-08-01 13:21:43 UTC
This is fixed.