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 168881 - after restarting CUPS IPP printers do not appear again
after restarting CUPS IPP printers do not appear again
Status: RESOLVED FIXED
Product: gnome-cups-manager
Classification: Deprecated
Component: gnome-cups-manager
unspecified
Other All
: High normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2005-03-01 15:15 UTC by Martin Pitt
Modified: 2008-01-29 13:09 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10


Attachments
proposed fix (517 bytes, patch)
2005-03-04 11:06 UTC, Martin Pitt
none Details | Review

Description Martin Pitt 2005-03-01 15:15:03 UTC
Steps to reproduce:
1. enable browsing in CUPS and set up a remote printer
2. start gnome-cups-manager
3. restart cupsys
4. wait a few seconds, g-c-m crashes with SIGPIPE


Stack trace:
  • #0 __kernel_vsyscall
  • #1 send
    from /lib/tls/i686/cmov/libpthread.so.0
  • #2 httpPrintf
    from /usr/lib/libcups.so.2
  • #3 httpGetLength
    from /usr/lib/libcups.so.2
  • #4 httpPost
    from /usr/lib/libcups.so.2
  • #5 cupsDoFileRequest
    from /usr/lib/libcups.so.2
  • #6 request_thread_main
    at gnome-cups-request.c line 365
  • #7 g_static_rw_lock_free
    from /usr/lib/libglib-2.0.so.0
  • #8 g_static_private_free
    from /usr/lib/libglib-2.0.so.0
  • #9 start_thread
    from /lib/tls/i686/cmov/libpthread.so.0
  • #10 clone
    from /lib/tls/i686/cmov/libc.so.6


Other information:
The problem is in libgnomecups/gnome-cups-request.c, request_thread_main():

        /* This is a deferred open for the first connection */
        if (!request->connection->http)
                request->connection->http = httpConnectEncrypt
(request->connection->server, ippPort(), cupsEncryption());

        response = cupsDoRequest (request->connection->http, request->request,
                                  request->path);

This uses sloppy initialization, so an existing HTTP connection stays open and
is reused. After restarting CUPS, the connection is not valid any more, which
explains the SIGPIPE.

I already tried to do

  httpClose (request->connection->http);
  request->connection->http = NULL;

after this, to not reuse connections. This helps to survive the crash, but after
this the printers don't appear any more in g-c-m (this could very well be an
entirely different bug, though).

So please either don't reuse connections at all (like I tried with my patch), or
intercept SIGPIPE and reconnect when receiving this signal. But since the latter
is very Linux/Unix specific, and starting a connection is not _that_ expensive,
I would suggest using the first approach.

Anyway, do you have any hint how to make g-c-m display new IPP printers after a
CUPS restart?
Comment 1 Jody Goldberg 2005-03-03 15:01:24 UTC
you are seeing a different bug
The problem is not the sigpipe, that is not fatal.
There was a different bug that has now been fixed in cvs (0.29)
Comment 2 Martin Pitt 2005-03-03 15:14:57 UTC
Oh, I just saw that g-c-m only crashes with SIGPIPE when debugging it; sorry for
the noise The "different" bug is certainly the NULL pointer in eggiconlist.c (I
already fixed that).

However, I reopened and renamed this bug because the second part is still an
issue: "after restarting cupsys, IPP printers don't appear any more in g-c-m"
[..] "do you have any hint how to make g-c-m display new IPP printers after a
CUPS restart?"

Thanks,

Martin
Comment 3 Martin Pitt 2005-03-03 16:36:57 UTC
I made an interesting discovery:

- I put a printf() in pinter_added_cb(); this is always called correctly after
restarting CUPS.

- IPP printers indeed appear again after restarting CUPS _if_ there is at least
one local printer in addition.

- IPP printers do not appear again if there are no local printers.
Comment 4 Martin Pitt 2005-03-04 11:06:00 UTC
Created attachment 38239 [details] [review]
proposed fix

This patch is minimally intrusive (add one line) and safe; however, it is more
like a workaround rather than a proper fix for the actual bug.

With this patch and the recent egg icon list fix in CVS, g-c-m now works
beautifully with cupsys restarts.

As an explanation why I make such a fuss about it: in Ubuntu we add a g-c-m
interface for enabling/disabling CUPS browsing support, and to make this change
effective we need to restart CUPS. Then network printers should immediately be
visible in g-c-m.
Comment 5 Jody Goldberg 2005-03-07 17:04:33 UTC
I'm not seeing any problems in cvs without this patch.
When I restart the printer disappears and reappears.
There was a problem in gnome-cups-manager where it would only call update if the
cupsd restarted, but that was fixed.  Are you sure you still need this patch
with cvs head ?
Comment 6 Martin Pitt 2005-03-08 11:48:31 UTC
Confirmed, CVS HEAD works fine.
Comment 7 Kjartan Maraas 2008-01-29 13:09:59 UTC
Moving all gnome-cups-manager bugs to new product. Filter on Kjartan's spring cleaning.