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 157829 - print list should be populated asyncronously
print list should be populated asyncronously
Status: RESOLVED FIXED
Product: gnome-print
Classification: Deprecated
Component: general
CVS
Other Linux
: High normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2004-11-10 06:43 UTC by Andreas J. Guelzow
Modified: 2005-02-18 17:44 UTC
See Also:
GNOME target: 2.10.0
GNOME version: ---


Attachments
async interface for getting the ppd (20.93 KB, patch)
2005-02-04 15:08 UTC, Matthias Clasen
committed Details | Review
small locking fix (1.03 KB, patch)
2005-02-04 15:09 UTC, Matthias Clasen
committed Details | Review
retrieve printers asynchronously in libgnomeprint (3.53 KB, patch)
2005-02-04 15:12 UTC, Matthias Clasen
committed Details | Review
retrieve ppds asynchronously in libgnomeprint (I think the previous patch may apply after this one) (9.44 KB, patch)
2005-02-04 15:14 UTC, Matthias Clasen
committed Details | Review
make libgnomeprintui work with async retrieval (4.75 KB, patch)
2005-02-04 15:16 UTC, Matthias Clasen
committed Details | Review

Description Andreas J. Guelzow 2004-11-10 06:43:08 UTC
I see this problem with both gedit and gnumeric:
I have 2 cups printers. In the application I select `print' then choose one
printer and click on the configure button. then selct `close' in the configure
dialog. afterwards alternate between selecting one and then the otehr printer.
After 3 or 4 switches the print dialog becomes non-responsive.
Comment 1 Jody Goldberg 2004-11-10 18:11:12 UTC
I'm unable to replicate this.
There are too many possibilities to figure this out
 - cups thread hanging
 - some sort of dialog problem with nested main loops?
Comment 2 Andreas J. Guelzow 2004-11-10 23:03:49 UTC
back traces at the time of a hang seem useless:

Program received signal SIGINT, Interrupt.

Thread 65541 (LWP 16175)

  • #0 connect
    from /lib/libpthread.so.0
  • #1 ??
  • #2 ??
  • #3 ??
  • #4 ??
  • #5 ??
  • #6 ??
  • #7 ??
  • #8 ??
  • #9 ??
  • #10 h_errno
    from /lib/libc.so.6
  • #11 ??
  • #12 ??
  • #13 ??
  • #14 ??
  • #15 ??
  • #16 ??
  • #17 ??
  • #18 ??
  • #19 ??

Comment 3 Andreas J. Guelzow 2004-11-10 23:49:22 UTC
Some further observations:

It seems I do not need to have opened the configure dialog. Just switching
between the 2 printers fac and lp suffices (90% of the time) provided I am
online, ie. the printer fac is in fact accessible. Online here means a slow
dial-up: to get the ppd file for that printer takes 3 or 4 seconds. 

While gnumeric is running I see groups of 3 threads being created. The hang
always seems to happen just before the 3rd group should be created.

It definitely looks like it has something to do with those threads when there is
some slow communication with one printer.
Comment 4 Jody Goldberg 2004-11-11 19:01:57 UTC
I'm going to guess that this a is a libgnomecups problem.
Once things have started try setting the magic global variable _gnome_cups_debug
to TRUE.   Let's see if that sheds any light on where things freeze.

Another possibility (although unlikely) would be that it's somehow getting to
the authentication bogosity.  We can add a g_warning in cups_password_cb
Comment 5 Jody Goldberg 2004-11-16 15:16:18 UTC
Any feedback here ?  This worries me.
Comment 6 Andreas J. Guelzow 2004-11-16 18:12:52 UTC
setting _gnome_cups_debug to TRUE does not provide any useful information:

---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
<<<<----- unlocking 0x88f5218
---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
<<<<----- unlocking 0x88f5218
---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
printer-uri	[0] = 'ipp://localhost/printers/lp'
<<<<----- unlocking 0x88f5218
---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
printer-uri	[0] = 'ipp://localhost/printers/lp'
requested-attributes	[0] = 'printer-state'
	[1] = 'queued-job-count'
	[2] = 'printer-location'
	[3] = 'printer-info'
	[4] = 'printer-state-message'
	[5] = 'device-uri'
	[6] = 'printer-state-reasons'
	[7] = 'printer-info'
	[8] = 'printer-make-and-model'
	[9] = 'printer-uri-supported'

(gnumeric:12687): GnomePrintCupsPlugin-WARNING **: iconv does not support ppd
character encoding: ISOLatin1, trying CSISOLatin1
<<<<----- unlocking 0x88f5218
---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
printer-uri	[0] = 'ipp://localhost/printers/fac'
<<<<----- unlocking 0x88f5218
---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
printer-uri	[0] = 'ipp://localhost/printers/fac'
requested-attributes	[0] = 'printer-state'
	[1] = 'queued-job-count'
	[2] = 'printer-location'
	[3] = 'printer-info'
	[4] = 'printer-state-message'
	[5] = 'device-uri'
	[6] = 'printer-state-reasons'
	[7] = 'printer-info'
	[8] = 'printer-make-and-model'
	[9] = 'printer-uri-supported'
<<<<----- unlocking 0x88f5218
---->>>  locking 0x88f5218
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
<<<<----- unlocking 0x88f5218
---->>>  locking 0x8786870
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
printer-uri	[0] = 'ipp://cups.lab.math.concordia.ab.ca/printers/fac'
requested-attributes	[0] = 'printer-state'
---->>>  locking 0x8786520
attributes-charset	[0] = 'utf-8'
attributes-natural-language	[0] = 'en'
printer-uri	[0] = 'ipp://kirkman:631/printers/lp'
requested-attributes	[0] = 'printer-state'
	[1] = 'queued-job-count'
	[2] = 'printer-location'
	[3] = 'printer-info'
	[4] = 'printer-state-message'
	[5] = 'device-uri'
	[1] = 'queued-job-count'
	[2] = 'printer-location'
	[3] = 'printer-info'
	[4] = 'printer-state-message'
	[5] = 'device-uri'
	[6] = 'printer-state-reasons'
	[7] = 'printer-info'
	[8] = 'printer-make-and-model'
	[9] = 'printer-uri-supported'
	[6] = 'printer-state-reasons'
	[7] = 'printer-info'
	[8] = 'printer-make-and-model'
	[9] = 'printer-uri-supported'
<<<<----- unlocking 0x8786870


Note that the last output occurs several selection cycles before the programs hang.
Comment 7 Andreas J. Guelzow 2004-11-16 18:21:43 UTC
Adding a g_warning in cups_password_cb does not yield any new information. We do
not seem to get into that function.
Comment 8 Andreas J. Guelzow 2004-11-16 18:25:21 UTC
Looking a t the debug spew again one notices that we have

---->>>  locking 0x8786870
---->>>  locking 0x8786520
<<<<----- unlocking 0x8786870

We never seem to have unlocking for 0x8786520




Comment 9 Andreas J. Guelzow 2004-11-16 20:31:44 UTC
The hang was due to a misconfiguration on the test machine. Nevertheless it
exposed a more general problem:

libgnomeprint/libgnomecups uses the device uri of a printer thereby bypassing
the configured cupsd server. As a result if the device uri is temporarily
unreachable, programs using libgnomeprint/libgnomecups will hang although the
primary server may be available and responsive (and would hold any printjob
until the printer becomes again available.)

This design makes libgnomeprint/libgnomecups depending on the network status
even if the cups setup would normally hide the problem.
Comment 10 Jody Goldberg 2004-11-16 23:18:23 UTC
I've commited a small patch to bypass that optimization.  That doesn't solve all
of the problem though.  Even if the connection to the remote machine was
blocking and timing out, the ui should not freeze.  For 2.9.x we need to fix the
ui to be fully async about printer attribute updates.
Comment 11 Jody Goldberg 2004-11-18 16:12:55 UTC
Some new information has come in

1) It was not a hang, just a long delay until the attempted connection timed out
2) The patch to disable the optimzation to go diectly to remote servers is in
and avoid the delay
3) We really should not be pulling in any of this information syncronously
Comment 12 Luis Villa 2005-01-22 20:46:18 UTC
Given your #2, Jody, I think it is safe to say that this isn't a 2.10
showstopper- is that correct?
Comment 13 Jody Goldberg 2005-01-26 16:55:12 UTC
luis : It's not a show stopper, but it is a high priority.
In environments with broken cups/network we can end up blocking a long time
Unfortunately we appear to have lost the bangalorian I'd been talking to on this.
Comment 14 Matthias Clasen 2005-02-03 15:24:14 UTC
Jody, you are aware that we still haven't gotten all RH async patches upstreamed ?
They address the issue by making all cups requests asynchronously. Do you want
me to attach the outstanding patches here ?
Comment 15 Jody Goldberg 2005-02-03 16:31:25 UTC
mathias : yes, please.
Comment 16 Elijah Newren 2005-02-03 21:05:27 UTC
Matthias doesn't appear to be on the cc list, so I'm adding him to make sure he
gets Jody's comment...
Comment 17 Matthias Clasen 2005-02-04 15:08:25 UTC
Created attachment 36984 [details] [review]
async interface for getting the ppd
Comment 18 Matthias Clasen 2005-02-04 15:09:13 UTC
Created attachment 36985 [details] [review]
small locking fix
Comment 19 Matthias Clasen 2005-02-04 15:12:23 UTC
Created attachment 36987 [details] [review]
retrieve printers asynchronously in libgnomeprint
Comment 20 Matthias Clasen 2005-02-04 15:14:31 UTC
Created attachment 36988 [details] [review]
retrieve ppds asynchronously in libgnomeprint (I think the previous patch may apply after this one)
Comment 21 Matthias Clasen 2005-02-04 15:16:25 UTC
Created attachment 36990 [details] [review]
make libgnomeprintui work with async retrieval
Comment 22 Jody Goldberg 2005-02-08 16:21:45 UTC
Comment on attachment 36987 [details] [review]
retrieve printers asynchronously in libgnomeprint

I've committed a variant of this.
Comment 23 Vincent Noel 2005-02-16 19:42:34 UTC
What about the other patches ?
Comment 24 Jody Goldberg 2005-02-18 17:44:36 UTC
Ok, thats the last of them.
The code copied from cups is a somewhat scary, but give the speed of development
there it's unlikely to cause problems.