githubashto / jzebra

Automatically exported from code.google.com/p/jzebra
0 stars 1 forks source link

Network listing too slow #220

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create some network printers
2. Keep the printer off / unplugged
3. Try to List / Detect printers

It will take a long time to process (more than 2 minutes with 2 network 
printers plus local ones).

You could do two things:

1. Define a parameter to only check for local printers

2. Define a parameter to set the timeout when searching for network printers.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?

1.8.0
Chrome, Win7

Original issue reported on code.google.com by ramiroca...@gmail.com on 16 Jun 2014 at 10:45

GoogleCodeExporter commented 9 years ago
From my experience, this is almost always an issue with the locally installed 
printers using a really poor driver.  Sometimes this is multiplied on systems 
that no longer have some printers attached.

The idea of "filter" for a locally installed printer is not possible because 
getting the attributes of the printers to filter for "local" versus "network" 
would cause this very delay.

The only real solution is to fix the printer drivers to respond faster, 
sometimes this involves turning off the often problematic SNMP features, but 
most often this involves some sort of investigation into bugs with the specific 
drivers, i.e. HP Universal Printer driver conflicts with old non-existent 
printer mappings.

Another work-around may be to use the default printer.

-Tres

Original comment by tres.fin...@gmail.com on 17 Jun 2014 at 2:20

GoogleCodeExporter commented 9 years ago
Also, it's very likely that this is a bug with Java and Windows printers, but 
if you examine the printer search code it is very basic and there is very 
little that can be done without majorly breaking search capabilities.

If you have a code snippet you believe will fix this, feel free to issue a pull 
request against 1.8.x on github.

Original comment by tres.fin...@gmail.com on 17 Jun 2014 at 2:22

GoogleCodeExporter commented 9 years ago
Ok, that's true.

Every app windows (like Word, Chrome, Outlook) has this delay when a network 
printer is off, and you try to open Printer Page.

I just tought that could be possible to determine a timeout, just to ignore 
these printers that are offline.

But thanks anyway, i will say to people here to use Default Printer. This is 
really fast.

Original comment by ramiroca...@gmail.com on 17 Jun 2014 at 3:18

GoogleCodeExporter commented 9 years ago
Here's the exact line of code it's hanging on:
https://github.com/qzindustries/qz-print/blob/1.8.0/qz-print/src/qz/PrintService
Matcher.java#L76

It's simply asking for the printer name.  A timeout value would be a good 
proposal if Java allowed such a thing easily:
http://docs.oracle.com/javase/7/docs/api/javax/print/PrintService.html#getAttrib
ute(java.lang.Class)

Without it, some complex thread interruption would have to occur and that code 
could get ugly fast.

Two minutes is certainly excessive, but I've only seen this wait on Windows 
with the vendor supplied bloatware drivers.  HP for example has managed to jam 
pack hundreds of MB of software into something that they consider a universal 
driver and it seems to only work well if its the only HP driver in use on that 
system.

Perhaps you could provide some details about the printers that are causing this 
issue for you so that a support ticket can be placed to ask the vendor to stop 
breaking the Operating System. :)

Original comment by tres.fin...@gmail.com on 17 Jun 2014 at 3:33

GoogleCodeExporter commented 9 years ago
I see, i will work on this later.

The printers are an old Deskjet 930C and a Okidata C5200n. But they only 
response like this when they are at network.

If i install them local, there's no problem.

Original comment by ramiroca...@gmail.com on 17 Jun 2014 at 3:49

GoogleCodeExporter commented 9 years ago
Is the 930c supported on your operating system?  Was that model offered in 
network connectivity or are you using a 3rd party print server?

I remember getting an old HP deskjet running on a print server and it would 
only work if I had installed the drivers first when it was plugged in to USB 
meaning it was never intended to be shared over the network.

Either way, please post any progress you have here as it's likely to show up 
again down the road.

-Tres

Original comment by tres.fin...@gmail.com on 17 Jun 2014 at 4:03