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 677081 - non-responding print server prevents session initialization
non-responding print server prevents session initialization
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: printers
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: Marek Kašík
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-05-30 10:37 UTC by Guillaume Rousse
Modified: 2012-06-26 12:05 UTC
See Also:
GNOME target: 3.6
GNOME version: ---


Attachments
perform connection test before connecting to CUPS server (6.08 KB, patch)
2012-06-15 09:57 UTC, Marek Kašík
reviewed Details | Review
perform connection test before connecting to CUPS server (8.44 KB, patch)
2012-06-22 11:34 UTC, Marek Kašík
committed Details | Review

Description Guillaume Rousse 2012-05-30 10:37:32 UTC
When a network print server is configured in ~/.cups/client.conf, but is not responding (typical example: corporate server, unreachable outside of corporate network), the session initialization fails with usual "ooops, something wrong happened" error windows.

This was original reported as https://bugs.mageia.org/show_bug.cgi?id=4708
Comment 1 Guillaume Rousse 2012-05-30 10:54:07 UTC
Here is relevant ~/.xsession-errors content:
/etc/X11/gdm/Xsession: Beginning session setup...
localuser:guillaume being added to access control list
/etc/X11/gdm/Xsession: Setup done, will execute: /usr/bin/ssh-agent --
/usr/share/X11/xdm/Xsession GNOME
GNOME_KEYRING_CONTROL=/run/user/guillaume/keyring-AM1toK
GNOME_KEYRING_CONTROL=/run/user/guillaume/keyring-AM1toK
GNOME_KEYRING_CONTROL=/run/user/guillaume/keyring-AM1toK
GPG_AGENT_INFO=/run/user/guillaume/keyring-AM1toK/gpg:0:1
GNOME_KEYRING_CONTROL=/run/user/guillaume/keyring-AM1toK
GPG_AGENT_INFO=/run/user/guillaume/keyring-AM1toK/gpg:0:1
SSH_AUTH_SOCK=/run/user/guillaume/keyring-AM1toK/ssh
gnome-session[25360]: WARNING: Application 'gnome-settings-daemon.desktop'
failed to register before timeout

And here is tcpdump output showing attempt to reach a non-existing print server
at 192.168.0.1, with exponential delay:
  8  12.649647 128.93.30.10 -> 192.168.0.1  TCP 74 51391 > ipp [SYN] Seq=0
Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13885146 TSecr=0 WS=128
  9  13.651625 128.93.30.10 -> 192.168.0.1  TCP 74 51391 > ipp [SYN] Seq=0
Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13886148 TSecr=0 WS=128
 10  15.655615 128.93.30.10 -> 192.168.0.1  TCP 74 51391 > ipp [SYN] Seq=0
Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13888152 TSecr=0 WS=128
|..]
 12  19.663643 128.93.30.10 -> 192.168.0.1  TCP 74 51391 > ipp [SYN] Seq=0
Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13892160 TSecr=0 WS=128
 13  27.679640 128.93.30.10 -> 192.168.0.1  TCP 74 51391 > ipp [SYN] Seq=0
Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13900176 TSecr=0 WS=128
 14  43.727593 128.93.30.10 -> 192.168.0.1  TCP 74 51391 > ipp [SYN] Seq=0
Win=14600 Len=0 MSS=1460 SACK_PERM=1 TSval=13916224 TSecr=0 WS=128
Comment 2 Matthias Clasen 2012-06-12 10:51:59 UTC
Hmm, thats pretty bad
Comment 3 Marek Kašík 2012-06-13 12:17:36 UTC
Hi,

I believe that this is the same problem as we solved in #586207 for Gtk+. I'll implement an asynchronous test of reachability of the CUPS server. I plan to use "g_socket_client_connect_to_host_async ()" which will perform test connection to specified host.

Regards

Marek
Comment 4 Marek Kašík 2012-06-13 12:21:37 UTC
(In reply to comment #3)
> I plan to use "g_socket_client_connect_to_host_async ()"...

Or whichever async operation of Glib is suitable here.
Comment 5 Marek Kašík 2012-06-15 09:57:44 UTC
Created attachment 216499 [details] [review]
perform connection test before connecting to CUPS server

Hi,

attached is a patch which fixes the problem in master. It tests whether it is possible to connect to a CUPS server given by cupsServer() and ippPort() before it actually tries to get destinations from the server and before it tries to create a subscription. It does it asynchronously so it doesn't block start of the daemon. The communication with the CUPS server itself is synchronous. This improves the patch from #674551.

Regards

Marek
Comment 6 Matthias Clasen 2012-06-15 10:23:59 UTC
Review of attachment 216499 [details] [review]:

::: plugins/print-notifications/gsd-print-notifications-manager.c
@@ +1034,1 @@
+        get_dests_with_connection_test (manager);

Shouldn't this be reorganized a little ?
Do we really want to attempt the get_dests() when the connection test done for subscription already indicated that cups is not there ? And if get_dest fails here, do we ever attempt to get them again, later ?

Basically, the flow I would expect (modulo async) is

if (cups responds) {
  renew subscription
  get dests
}
queue subscription renewal
Comment 7 Marek Kašík 2012-06-15 11:06:40 UTC
(In reply to comment #6)
> Shouldn't this be reorganized a little ?

I'll look at it next week.

> Do we really want to attempt the get_dests() when the connection test done for
> subscription already indicated that cups is not there ? And if get_dest fails
> here, do we ever attempt to get them again, later ?
> 
> Basically, the flow I would expect (modulo async) is
> 
> if (cups responds) {
>   renew subscription
>   get dests
> }
> queue subscription renewal

Marek
Comment 8 Marek Kašík 2012-06-22 11:34:03 UTC
Created attachment 217016 [details] [review]
perform connection test before connecting to CUPS server

Hi,

this patch runs connection test first. After successful connection it gets destinations, creates subscription and adds a timeout for renewing of the subscription.
It fixes the problem for me.

Unfortunately I found another problem during fixing of this. If you create a subscription on a remote server then you won't get dbus notifications from it. We have to implement a polling mechanism for pulling these notifications... I filled bug #678623 for this.

Regards

Marek
Comment 9 Matthias Clasen 2012-06-22 23:48:16 UTC
Review of attachment 217016 [details] [review]:

Looks reasonable to me now. Unfortunate that it requires so much code
Comment 10 Marek Kašík 2012-06-26 12:05:15 UTC
Comment on attachment 217016 [details] [review]
perform connection test before connecting to CUPS server

I've committed the patch to master branch.

Marek