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 635588 - Clicking URL to be opened freezes the application for 3-5 seconds
Clicking URL to be opened freezes the application for 3-5 seconds
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.27.x
Other Linux
: Urgent blocker
: ---
Assigned To: gtkdev
gtkdev
: 636866 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-11-23 07:39 UTC by Milan Crha
Modified: 2011-05-25 08:55 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Milan Crha 2010-11-23 07:39:25 UTC
I'm using git master of glib (260d005) and gvfs (87d354e), and when I click the URL in Evolution from the bugzilla email, then the application freezes for about 3-5 seconds, regardless whether the firefox is opened or not.

This is very irritating, because it used to be quick, and it seems like having trouble now.
Comment 1 Bastien Nocera 2010-11-23 16:51:07 UTC
Most likely unrelated to gvfs itself. What are you actually calling?

Calling g_app_info_get_default_for_uri_scheme() is fast. g_app_info_launch_default_for_uri() is also very fast. I tested both in a simple test program.
Comment 2 Bastien Nocera 2010-11-23 16:59:35 UTC
gtk_show_uri() is slow, but g_app_info_launch_default_for_uri() is fast.

---8<---
#include <gtk/gtk.h>

int main (int argc, char **argv)
{
	guint i;

	gtk_init (&argc, &argv);

//	gtk_show_uri (NULL, "https://bugzilla.gnome.org/show_bug.cgi?id=635588", 0L, NULL);
	g_app_info_launch_default_for_uri ("https://bugzilla.gnome.org/show_bug.cgi?id=635588", NULL, NULL);

	return 0;
}
---8<---
Comment 3 Bastien Nocera 2010-11-23 17:12:08 UTC
This code shows the problem. With a context, it takes a couple of seconds
before launching the app, without it, it works as expected.

--8<--
#include <gtk/gtk.h>

int main (int argc, char **argv)
{
        GdkAppLaunchContext *context;

        gtk_init (&argc, &argv);

        context = gdk_app_launch_context_new (); 
        gdk_app_launch_context_set_screen (context, gdk_screen_get_default ());
        gdk_app_launch_context_set_timestamp (context, GDK_CURRENT_TIME);

        g_app_info_launch_default_for_uri
("https://bugzilla.gnome.org/show_bug.cgi?id=635588", (GAppLaunchContext *)
context, NULL);
//      g_app_info_launch_default_for_uri
("https://bugzilla.gnome.org/show_bug.cgi?id=635588", NULL, NULL);

        return 0;
}
--8<--
Comment 4 Matthias Clasen 2010-11-28 04:14:29 UTC
Committed a workaround
Comment 5 Milan Crha 2010-11-29 15:51:26 UTC
(In reply to comment #4)
> Committed a workaround

Where did you commit this, please? I'm using gtk-2-24 branch and I still see it there, more that that the 
  $ git log | grep 635588
shows empty result. I'm at commit 6e2573f right now.
Comment 6 Javier Jardón (IRC: jjardon) 2010-11-29 17:29:06 UTC
Milan, the patch was applied in master:

http://git.gnome.org/browse/gtk+/commit/?id=b0bf2b5202782526edcba678c6239baecf897b16
Comment 7 Milan Crha 2010-11-29 18:40:03 UTC
Ah, thanks, can it be committed to gtk-2-24 too, please?
Comment 8 Matthias Clasen 2010-11-29 19:22:22 UTC
Sure, it can
Comment 9 Javier Jardón (IRC: jjardon) 2010-11-29 20:10:27 UTC
Pushed in gtk-2-24 branch: http://git.gnome.org/browse/gtk+/commit/?h=gtk-2-24&id=b2274ba08a832e9e8299f4d2642f1f38a4a7c4c3
Comment 10 Christian Persch 2010-12-09 14:05:31 UTC
*** Bug 636866 has been marked as a duplicate of this bug. ***
Comment 11 Milan Crha 2011-01-10 12:15:01 UTC
I'm at gtk+ commit 5c3b49a and I still see a delay. My network is not so quick, so it can be the reason. I also see a new application "Opening show_bug.cgi" in the task bar, between my other applications, though clicking this button doesn't do anything (it doesn't show the window). I believe that this thing is causing all the trouble.

I also realized I cannot pass partial URL to the browser, (I expect gtk_open_uri function is meant to do it for me, especially with uris beginning with http/https). As an example, opening URL:
   https://admin.fedoraproject.org/pkgdb/acls/name/
results in 500 error in the browser, which I believe is fine, because I will type a package name at the end and be happy, but right now, with the above mentioned gtk+ commit, I get an error instead "HTTP Error: Internal error", so the ling doesn't get it to the browser at all.

I do not think this is the right thing to be done and I believe this is caused be the "Opening..." application which is causing the page being opened twice, once in that application to verify the URL (an unnecessary step), and the second time when the browser itself opens the page again. Imagine a large page, or slow network/server, then there is a) delay, b) unnecessary load on the server doing each request twice. When the only thing to be done is to pass the URL to the application registered as a handler for the http/https uris.

If you are wondering, my glib commit is a57c4c9 and my gvfs commit is 9fb3e91.
Comment 12 Milan Crha 2011-02-01 11:35:24 UTC
I'm setting this to blocker.
a) it is still slow, nothing from the above helped at all when the server is slow (the application which is invoking the link is stuck with no response for couple seconds)
b) more importantly, I have a valid URL which I'm trying to open, which requires authentication, which, you may not believe me, the browser knows about and has credentials already, but I get only an error response from the function call:
  HTTP Client Error: Authorization Required
and I'm forced to copy&paste the URL from my mail window to the browser, instead of just clicking on it.
c) when I have an http/https url which results in text/plain content then it's opened in gedit instead of the web browser. It's really not that what I want from it. Try clicking this URL [1] from terminal, for example.

You really shouldn't check the content before passing URL to the browser, which knows much better what to do with the URL than "you". Apart of the above, please try with slow connection and slow server too. You may finally realize what I'm talking about.

I'm at glib commit 401a423 and gvfs commit 10f4959.

[1] http://bugzilla-attachments.gnome.org/attachment.cgi?id=172711
Comment 13 Milan Crha 2011-02-24 18:13:21 UTC
I just got an issue in valgrind and they write URL as this:
   www.valgrind.org
in the middle of the text on a terminal. I can click above it and choose "Open link", but it is not opened anyway, the error message is shown instead:

   Could not open the address “http:www.valgrind.org”
   Automount failed: Invalid mount spec

When talking about terminals, if I have opened multiple of them, and try to open a url from a slow server in one of them, then all other terminals are frozen as well, they even do not paint. I was told that it's because multiple terminal windows are handled by one terminal process, which can make sense.
Comment 14 Kjartan Maraas 2011-05-25 07:09:06 UTC
This probably shouldn't be a blocker since it's been in that state for nearly four months without any movement… Milan, are you still seeing these problems or have other issues been at play here?
Comment 15 Milan Crha 2011-05-25 08:55:03 UTC
OK, I have installed Fedora 15 with glib2-2.28.6-2.fc15.x86_64 and:
From comment #11, partial uri, is not there, I can use that sample URL.

From comment #12:
ad b), authenticated urls, are passed into the browser too.
ad c), text/plain parts, maybe I have something disabled here, but it seems it doesn't suffer of that too

From comment #13, the www.valgrind.org is openable.

So yes, this is fixed with that version. Thanks for a reminder and "silent" fixes.