qzind / tray

Browser plugin for sending documents and raw commands to a printer or attached device.
https://qz.io
Other
837 stars 272 forks source link

Java runs out of memory when printing #27

Closed klabarge closed 8 years ago

klabarge commented 8 years ago

Tested on Windows 10

This seems to primarily happen when printing PDF's, but I have witnessed this issue with HTML printing as well.

Steps to reproduce:

  1. Launch QZ Tray with 1GB of RAM:

    java -Xms1024m -Xmx1024m -jar "%PROGRAMFILES%\QZ Tray\qz-tray.jar"
  2. View QZ Tray in the task manager.

    image

  3. Print a PDF and observe the memory usage increase, and then never decrease

    image

  4. Repeat until the memory cap is reached, and printing is no longer possible

    image

  5. Stack trace when Java runs out of memory and cannot print:

    [DEBUG] 2016-04-06 23:56:19,708 @ qz.ws.PrintSocketClient:?
         Message: {"call":"print","promise":{},"params":{"printer":{"name":"Microsoft XPS
    Document Writer"},"options":{"colorType":"color","copies":"1","density":"","duplex":false
    ,"interpolation":"","jobName":"","margins":"0","orientation":"","paperThickness":"","prin
    terTray":"","rasterize":true,"rotation":"15","scaleContent":true,"size":null,"units":"in"
    ,"altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"html","
    format":"plain","data":"<html>   <table style=\"font-family: monospace; border: 1px;\">
    <tr style=\"height: 6cm;\">           <td valign=\"top\"><h2>*&nbsp; QZ Print Plugin
    HTML Printing &nbsp;*</h2><span style=\"color: #F00;\">Version:</span> 2.0.0-RC4<br/><sp
    an style=\"color: #F00;\">Visit:</span> https://qz.io/</td>           <td valign=\"top\">
    <img src=\"https://demo.qz.io/assets/img/image_sample.png\"></td>       </tr>   </table><
    /html>"}]},"timestamp":1460001379701,"uid":"k9dqi6"}
    [WARN] 2016-04-06 23:56:19,757 @ qz.ws.PrintSocketClient:?
       Bad signature on request
    [INFO] 2016-04-06 23:56:21,095 @ qz.common.TrayManager:?
       Allowed localhost to print to Microsoft XPS Document Writer
    [DEBUG] 2016-04-06 23:56:21,099 @ qz.printer.PrintServiceMatcher:?
       Searching for PrintService matching Microsoft XPS Document Writer
    [DEBUG] 2016-04-06 23:56:21,102 @ qz.printer.PrintServiceMatcher:?
       Found 10 printers
    [DEBUG] 2016-04-06 23:56:21,105 @ qz.printer.PrintServiceMatcher:?
       Found match: Microsoft XPS Document Writer
    [WARN] 2016-04-06 23:56:21,110 @ qz.printer.PrintOptions:?
       Cannot read  as a double for density, using default
    [WARN] 2016-04-06 23:56:21,115 @ qz.printer.PrintOptions:?
       Cannot read  as a valid value for interpolation, using default
    [WARN] 2016-04-06 23:56:21,120 @ qz.printer.PrintOptions:?
       Cannot read  as a valid value for orientation, using default
    [WARN] 2016-04-06 23:56:21,125 @ qz.printer.PrintOptions:?
       Cannot read  as a double for paperThickness, using default
    [DEBUG] 2016-04-06 23:56:21,127 @ qz.utils.PrintingUtilities:?
       Found Resolution: 60000x60000 dphi
    [DEBUG] 2016-04-06 23:56:21,237 @ qz.ws.PrintSocketClient:?
       Using qz.printer.action.PrintHTML to print
    [TRACE] 2016-04-06 23:56:21,264 @ qz.printer.action.WebApp:?
       Waiting for JavaFX..
    [DEBUG] 2016-04-06 23:56:21,641 @ qz.printer.action.WebApp:?
       Started JavaFX
    [TRACE] 2016-04-06 23:56:22,271 @ qz.printer.action.WebApp:?
       Waiting for capture..
    [TRACE] 2016-04-06 23:56:22,590 @ qz.printer.action.WebApp:?
       Done: -1.0 > 0.0
    [TRACE] 2016-04-06 23:56:22,593 @ qz.printer.action.WebApp:?
       New state: READY > SCHEDULED
    [TRACE] 2016-04-06 23:56:22,599 @ qz.printer.action.WebApp:?
       New state: SCHEDULED > RUNNING
    [TRACE] 2016-04-06 23:56:23,269 @ qz.printer.action.WebApp:?
       Done: 0.0 > 36.14954806902219
    [TRACE] 2016-04-06 23:56:23,275 @ qz.printer.action.WebApp:?
       Waiting for capture..
    [TRACE] 2016-04-06 23:56:23,321 @ qz.printer.action.WebApp:?
       Done: 36.14954806902219 > 100.0
    [TRACE] 2016-04-06 23:56:23,325 @ qz.printer.action.WebApp:?
       New state: RUNNING > SUCCEEDED
    [TRACE] 2016-04-06 23:56:23,359 @ qz.printer.action.WebApp:?
       Zooming in by x8.333333333333334 for increased quality
    [TRACE] 2016-04-06 23:56:23,366 @ qz.printer.action.WebApp:?
       Setting HTML page width to 6614.4000000000015
    [TRACE] 2016-04-06 23:56:23,477 @ qz.printer.action.WebApp:?
       Setting HTML page height to 2050.0
    [DEBUG] 2016-04-06 23:56:23,581 @ qz.printer.action.WebApp:?
       Attempting image capture
    [DEBUG] 2016-04-06 23:56:24,278 @ qz.printer.action.PrintHTML:?
       Parsed 1 html records
    [TRACE] 2016-04-06 23:56:24,387 @ qz.printer.action.PrintPixel:?
       DPI: 600.0      CNV: 72.0
    [TRACE] 2016-04-06 23:56:24,390 @ qz.printer.action.PrintPixel:?
       Drawable area: 0.0,0.0:8.268001,11.693
    [TRACE] 2016-04-06 23:56:24,394 @ qz.printer.action.PrintPixel:?
       [60000x60000 dphi, color, (0.0,0.0)->(210.007,297.002)mm]
    [INFO] 2016-04-06 23:56:24,783 @ qz.printer.action.PrintPixel:?
       Starting printing (1 copies)
    [TRACE] 2016-04-06 23:58:38,561 @ qz.printer.action.PrintImage:?
       Requested page 0 for printing
    [TRACE] 2016-04-06 23:58:39,157 @ qz.printer.action.PrintImage:?
       {Color rendering quality key=Highest quality color rendering mode, Global renderi
    ng quality key=Highest quality rendering methods, Global antialiasing enable key=Antialia
    sed rendering mode, Text-specific LCD contrast key=140, Alpha blending interpolation meth
    od key=Highest quality alpha blending methods, Image interpolation method key=Bicubic ima
    ge interpolation mode, Text-specific antialiasing enable key=Default antialiasing text mo
    de, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control
    key=Pure stroke conversion for accurate paths}
    [DEBUG] 2016-04-06 23:58:39,174 @ qz.printer.action.PrintImage:?
       Paper area: 0,0:595,792
    [TRACE] 2016-04-06 23:58:39,179 @ qz.printer.action.PrintImage:?
       Image size: 595,317
    [TRACE] 2016-04-06 23:58:39,183 @ qz.printer.action.PrintImage:?
       Requested page 0 for printing
    [TRACE] 2016-04-06 23:58:39,664 @ qz.printer.action.PrintImage:?
       {Color rendering quality key=Highest quality color rendering mode, Global renderi
    ng quality key=Highest quality rendering methods, Global antialiasing enable key=Antialia
    sed rendering mode, Text-specific LCD contrast key=140, Alpha blending interpolation meth
    od key=Highest quality alpha blending methods, Image interpolation method key=Bicubic ima
    ge interpolation mode, Text-specific antialiasing enable key=Default antialiasing text mo
    de, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control
    key=Pure stroke conversion for accurate paths}
    [DEBUG] 2016-04-06 23:58:39,681 @ qz.printer.action.PrintImage:?
       Paper area: 0,0:595,792
    [TRACE] 2016-04-06 23:58:39,685 @ qz.printer.action.PrintImage:?
       Image size: 595,317
    [TRACE] 2016-04-06 23:58:39,868 @ qz.printer.action.PrintImage:?
       Requested page 0 for printing
    [TRACE] 2016-04-06 23:58:40,566 @ qz.printer.action.PrintImage:?
       {Color rendering quality key=Highest quality color rendering mode, Global renderi
    ng quality key=Highest quality rendering methods, Global antialiasing enable key=Antialia
    sed rendering mode, Text-specific LCD contrast key=140, Alpha blending interpolation meth
    od key=Highest quality alpha blending methods, Image interpolation method key=Bicubic ima
    ge interpolation mode, Text-specific antialiasing enable key=Default antialiasing text mo
    de, Fractional metrics enable key=Integer text metrics mode, Stroke normalization control
    key=Pure stroke conversion for accurate paths}
    [DEBUG] 2016-04-06 23:58:40,585 @ qz.printer.action.PrintImage:?
       Paper area: 0,0:595,792
    [TRACE] 2016-04-06 23:58:40,590 @ qz.printer.action.PrintImage:?
       Image size: 595,317
    java.lang.OutOfMemoryError
    [ERROR] 2016-04-06 23:58:47,294 @ qz.ws.PrintSocketClient:?
       Connection error
    java.lang.RuntimeException: Cannot call method public void qz.ws.PrintSocketClient#onMess
    age(org.eclipse.jetty.websocket.api.Session, java.io.Reader) with args: [org.eclipse.jett
    y.websocket.common.WebSocketSession, org.eclipse.jetty.websocket.common.message.MessageRe
    ader]
       at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.unwrapRunti
    meException(CallableMethod.java:93)
       at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(Callab
    leMethod.java:75)
       at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMet
    hod.call(OptionalSessionCallableMethod.java:68)
       at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver$2.run(Jett
    yAnnotatedEventDriver.java:210)
       at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:63
    5)
       at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555
    )
       at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.InternalError: Problem in WPrinterJob_drawDIBImage
       at sun.awt.windows.WPrinterJob.drawDIBImage(Native Method)
       at sun.awt.windows.WPrinterJob.drawImage3ByteBGR(Unknown Source)
       at sun.awt.windows.WPathGraphics.redrawRegion(Unknown Source)
       at sun.print.RasterPrinterJob.printPage(Unknown Source)
       at sun.print.RasterPrinterJob.print(Unknown Source)
       at qz.printer.action.PrintPixel.printCopies(Unknown Source)
       at qz.printer.action.PrintImage.print(Unknown Source)
       at qz.ws.PrintSocketClient.processPrintRequest(Unknown Source)
       at qz.ws.PrintSocketClient.processMessage(Unknown Source)
       at qz.ws.PrintSocketClient.onMessage(Unknown Source)
       at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       at java.lang.reflect.Method.invoke(Unknown Source)
       at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(Callab
    leMethod.java:70)
       ... 5 more
tresf commented 8 years ago

Some observations... (Java 8 update 45)

  1. The bug report claims this is most prominent with PDFs, but it uses a stacktrace from HTML printing. We should be careful to debug one print component at a time.
  2. I tried to reproduce this with PDFs alone but was unable to. My machine has the default JVM settings, 8GB of ram available and although it would climb to 1,400 MB, it would settle back down to 660 MB once the limit was reached, so the garbage collector was kicking in properly.

However, when chaining HTML printing to the tail end, the jobs would eventually fail. I believe whatever memory caps @bberenz observed when doing HTML printing are starting to crop up again. PDFBOX seems to be able to handle it much more gracefully. This makes more sense to me as some of our premium customers have not yet complained of this. Let me know if your testing results differ.

akberenz commented 8 years ago

This looks like an issue with multiple concurrent print jobs running. Seems to be a limit around 512mb per job for all the resources required. (Sending 10 print jobs at once is a great way to reproduce).

Forcing synchronized on the print request calls would fix this problem as it creates a choke point on the resources. But this also limits how quickly systems with enough memory can process. I've created a pool system for the print processors, keeping a limit on how many processors can run simultaneously. Allowing larger systems to power through and smaller systems to avoid crashing.

The fix is under e8f353b699ed60d88edb243a5446d6c5a95b7f82, but I'll leave this open until you can verify it's handled properly on all systems.

klabarge commented 8 years ago

I am unable to print on my Windows 10 machine with this.

This seems to be working okay on Mac

The stack trace below is from an HTML print, but the results are the same for PDF, Image, and I also tested some raw printing.

Notice the last line says "Allowing 0 simultaneous processors based on memory available"

[DEBUG] 2016-04-08 19:47:21,395 @ qz.ws.PrintSocketClient:?
        Message: {"call":"print","promise":{},"params":{"printer":{"name":"Micro
soft XPS Document Writer"},"options":{"colorType":"color","copies":"1","density"
:"","duplex":false,"interpolation":"","jobName":"","margins":"0","orientation":"
","paperThickness":"","printerTray":"","rasterize":true,"rotation":"","scaleCont
ent":true,"size":{"width":"","height":""},"units":"in","altPrinting":false,"enco
ding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"html","format":"plain","
data":"<html>   <table style=\"font-family: monospace; border: 1px;\">       <tr
 style=\"height: 6cm;\">           <td valign=\"top\"><h2>*&nbsp; QZ Print Plugi
n HTML Printing &nbsp;*</h2><span style=\"color: #F00;\">Version:</span> 2.0.0-R
C5<br/><span style=\"color: #F00;\">Visit:</span> https://qz.io/</td>
<td valign=\"top\"><img src=\"https://demo.qz.io/assets/img/image_sample.png\"><
/td>       </tr>   </table></html>"}]},"timestamp":1460159241376,"uid":"2x0env"}

[WARN] 2016-04-08 19:47:21,400 @ qz.ws.PrintSocketClient:?
        Bad signature on request
[INFO] 2016-04-08 19:47:33,136 @ qz.common.TrayManager:?
        Allowed localhost to print to Microsoft XPS Document Writer
[DEBUG] 2016-04-08 19:47:33,140 @ qz.printer.PrintServiceMatcher:?
        Searching for PrintService matching Microsoft XPS Document Writer
[DEBUG] 2016-04-08 19:47:33,174 @ qz.printer.PrintServiceMatcher:?
        Found 10 printers
[DEBUG] 2016-04-08 19:47:33,175 @ qz.printer.PrintServiceMatcher:?
        Found match: Microsoft XPS Document Writer
[WARN] 2016-04-08 19:47:33,186 @ qz.printer.PrintOptions:?
        Cannot read  as a double for density, using default
[WARN] 2016-04-08 19:47:33,187 @ qz.printer.PrintOptions:?
        Cannot read  as a valid value for interpolation, using default
[WARN] 2016-04-08 19:47:33,190 @ qz.printer.PrintOptions:?
        Cannot read  as a valid value for orientation, using default
[WARN] 2016-04-08 19:47:33,191 @ qz.printer.PrintOptions:?
        Cannot read  as a double for paperThickness, using default
[WARN] 2016-04-08 19:47:33,192 @ qz.printer.PrintOptions:?
        Cannot read  as a double for rotation, using default
[WARN] 2016-04-08 19:47:33,194 @ qz.printer.PrintOptions:?
        Cannot read  as a double for size.width, using default
[WARN] 2016-04-08 19:47:33,195 @ qz.printer.PrintOptions:?
        Cannot read  as a double for size.height, using default
[DEBUG] 2016-04-08 19:47:33,426 @ qz.utils.PrintingUtilities:?
        Found Resolution: 60000x60000 dphi
[DEBUG] 2016-04-08 19:47:33,781 @ qz.utils.PrintingUtilities:?
        Allowing 0 simultaneous processors based on memory available
akberenz commented 8 years ago

Should avoid that scenario now (79fa6f433197a45fc284d4ef79bb1364d58ae22a) Out of curiosity, are you still running with -Xmx1024m? As that should have given you 2 print processors.

klabarge commented 8 years ago

For testing I launched it normally. I will test with both and report back. On Apr 8, 2016 9:13 PM, "bberenz" notifications@github.com wrote:

Should avoid that scenario now (79fa6f4 https://github.com/qzind/tray/commit/79fa6f433197a45fc284d4ef79bb1364d58ae22a ) Out of curiosity, are you still running with -Xmx1024m? As that should have given you 2 print processors.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/qzind/tray/issues/27#issuecomment-207675879

tresf commented 8 years ago

So Mac has an interesting way of reporting and handling the memory...

In my case, the physical machine had 16 GB available to it...

screen shot 2016-04-09 at 12 28 30 pm

Summary

tresf commented 8 years ago

Windows XP test results (Firefox 43, 2 GB ram, Java 1.8 u77)

Print PDF

Print HTML

[TRACE] 2016-04-09 14:06:54,895 @ qz.printer.action.WebApp:?
        Waiting for JavaFX..
Graphics Device initialization failed for :  d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(Unknown Source)
        at com.sun.javafx.tk.quantum.QuantumToolkit.init(Unknown Source)
        at com.sun.javafx.tk.Toolkit.getToolkit(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
        at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
        ... 1 more
Exception in thread "Thread-47" java.lang.RuntimeException: No toolkit found
        at com.sun.javafx.tk.Toolkit.getToolkit(Unknown Source)
        at com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
        at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$155(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
[TRACE] 2016-04-09 14:06:55,897 @ qz.printer.action.WebApp:?
        Waiting for JavaFX..
[TRACE] 2016-04-09 14:06:56,898 @ qz.printer.action.WebApp:?
        Waiting for JavaFX..
[TRACE] 2016-04-09 14:06:57,899 @ qz.printer.action.WebApp:?
        Waiting for JavaFX..
[TRACE] 2016-04-09 14:06:58,901 @ qz.printer.action.WebApp:?
        Waiting for JavaFX..
[ERROR] 2016-04-09 14:06:59,902 @ qz.ws.PrintSocketClient:?
        Failed to print
java.lang.UnsupportedOperationException: Unable to start JavaFX service
        at qz.printer.action.PrintHTML.parseData(Unknown Source)
        at qz.ws.PrintSocketClient.processPrintRequest(Unknown Source)
        at qz.ws.PrintSocketClient.processMessage(Unknown Source)
        at qz.ws.PrintSocketClient.onMessage(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:70)
        at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMethod.call(OptionalSessionCallableMethod.java:68)
        at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver$2.run(JettyAnnotatedEventDriver.java:210)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: JavaFX did not start
        at qz.printer.action.WebApp.initialize(Unknown Source)
        ... 14 more
lite1979 commented 8 years ago

Using Ubuntu Linux 14.04 LTS x64 8-core AMD 8320 processor, (24GB RAM on machine) no launch parameters

Inital startup/install: 216MB Find Printer: 220MB First PDF Print job: 624MB, then settles down to 620MB Second PDF Print job: 647MB, settles down to 640MB Third PDF Print job: 642MB Clicking PDF the 4th-12th time in rapid succession: 866MB After waiting 5 minutes and just idling: 571MB Sending another print job shortly after waiting 5 minutes: 918MB Additional print job after another 5 minutes: 918MB After idling for 10 more minutes: 917MB Update: 918MB after ten more minutes.

lite1979 commented 8 years ago

Using Ubuntu Linux 14.04 LTS x64 8-core AMD 8320 processor, (24GB RAM on machine) no launch parameters

Initial startup: 216MB First HTML print job: 1.4GB Second HTML print job: 2.4GB Third HTML print job: 3.4GB Fourth HTML print job: 4.4GB 5th-25th print jobs: holding steady at 4.6GB Still 4.6GB after forty-five minutes with no activity.

lite1979 commented 8 years ago

Linux Mint x64 17.3 with 6GB RAM,4-core intel i5, no launch parameters

Initial startup: 178MB First HTML print job: 280MB Second HTML print job: 280MB Third-15th HTML print job: 280MB Fifteen minutes later, only at 282MB

klabarge commented 8 years ago

Out of curiosity, are you still running with -Xmx1024m? As that should have given you 2 print processors.

When launching with -Xmx1024m, the console shows: Allowing 2 simultaneous processors based on memory available :+1:

I get similar results on my Windows 10 (16GB RAM) laptop as Tres did on XP.

  1. Without launching QZ Tray with a custom memory, the first PDF I try to print (all defaults) results in java.lang.OutOfMemoryError
  2. Launching with 512MB, I was able to print 4 times. On the 5th print, I did not receive the java.lang.OutOfMemoryError, but the software seemed to freeze at this point.
    • The console showed it was hung up after Found Resolution: 60000x60000 dphi
    • Comparing to a successful log, the next line in the console should have information on the amount of processors used
[DEBUG] 2016-04-10 19:14:19,644 @ qz.ws.PrintSocketClient:?
        Message: {"call":"print","promise":{},"params":{"printer":{"name":"Microsoft XPS Document Writer"},"options":{"colorType":"color","copies":"1","density":"","duplex":false,"interpolation":"","jobName":"","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":true,"rotation":"0","scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"pdf","data":"https://demo.qz.io/assets/pdf_sample.pdf"}]},"timestamp":1460330059639,"uid":"eho83k"}
[WARN] 2016-04-10 19:14:19,648 @ qz.ws.PrintSocketClient:?
        Bad signature on request
[INFO] 2016-04-10 19:14:21,299 @ qz.common.TrayManager:?
        Allowed localhost to print to Microsoft XPS Document Writer
[DEBUG] 2016-04-10 19:14:21,300 @ qz.printer.PrintServiceMatcher:?
        Searching for PrintService matching Microsoft XPS Document Writer
[DEBUG] 2016-04-10 19:14:21,301 @ qz.printer.PrintServiceMatcher:?
        Found 9 printers
[DEBUG] 2016-04-10 19:14:21,303 @ qz.printer.PrintServiceMatcher:?
        Found match: Microsoft XPS Document Writer
[WARN] 2016-04-10 19:14:21,305 @ qz.printer.PrintOptions:?
        Cannot read  as a double for density, using default
[WARN] 2016-04-10 19:14:21,306 @ qz.printer.PrintOptions:?
        Cannot read  as a valid value for interpolation, using default
[WARN] 2016-04-10 19:14:21,308 @ qz.printer.PrintOptions:?
        Cannot read  as a valid value for orientation, using default
[WARN] 2016-04-10 19:14:21,310 @ qz.printer.PrintOptions:?
        Cannot read  as a double for paperThickness, using default
[DEBUG] 2016-04-10 19:14:21,312 @ qz.utils.PrintingUtilities:?
        Found Resolution: 60000x60000 dphi
Stacktrace for PDF java.lang.OutOfMemoryError:
[DEBUG] 2016-04-10 18:55:40,250 @ qz.ws.PrintSocketClient:?
        Message: {"call":"print","promise":{},"params":{"printer":{"name":"Microsoft XPS Document Writer"},"options":{"colorType":"color","copies":"10","density":"","duplex":false,"interpolation":"","jobName":"","margins":"0","orientation":"","paperThickness":"","printerTray":"","rasterize":true,"rotation":"0","scaleContent":true,"size":null,"units":"in","altPrinting":false,"encoding":"","endOfDoc":"","perSpool":"1"},"data":[{"type":"pdf","data":"https://demo.qz.io/assets/pdf_sample.pdf"}]},"timestamp":1460328940245,"uid":"da71h4"}
[WARN] 2016-04-10 18:55:40,256 @ qz.ws.PrintSocketClient:?
        Bad signature on request
[INFO] 2016-04-10 18:55:41,295 @ qz.common.TrayManager:?
        Allowed localhost to print to Microsoft XPS Document Writer
[DEBUG] 2016-04-10 18:55:41,300 @ qz.printer.PrintServiceMatcher:?
        Searching for PrintService matching Microsoft XPS Document Writer
[DEBUG] 2016-04-10 18:55:41,331 @ qz.printer.PrintServiceMatcher:?
        Found 9 printers
[DEBUG] 2016-04-10 18:55:41,333 @ qz.printer.PrintServiceMatcher:?
        Found match: Microsoft XPS Document Writer
[WARN] 2016-04-10 18:55:41,346 @ qz.printer.PrintOptions:?
        Cannot read  as a double for density, using default
[WARN] 2016-04-10 18:55:41,346 @ qz.printer.PrintOptions:?
        Cannot read  as a valid value for interpolation, using default
[WARN] 2016-04-10 18:55:41,349 @ qz.printer.PrintOptions:?
        Cannot read  as a valid value for orientation, using default
[WARN] 2016-04-10 18:55:41,350 @ qz.printer.PrintOptions:?
        Cannot read  as a double for paperThickness, using default
[DEBUG] 2016-04-10 18:55:41,584 @ qz.utils.PrintingUtilities:?
        Found Resolution: 60000x60000 dphi
[DEBUG] 2016-04-10 18:55:41,837 @ qz.utils.PrintingUtilities:?
        Allowing 1 simultaneous processors based on memory available
[DEBUG] 2016-04-10 18:55:41,856 @ qz.ws.PrintSocketClient:?
        Using qz.printer.action.PrintPDF to print
[DEBUG] 2016-04-10 18:55:42,918 @ qz.printer.action.PrintPDF:?
        Parsed 1 files for printing
[TRACE] 2016-04-10 18:55:43,028 @ qz.printer.action.PrintPixel:?
        DPI: 600.0      CNV: 72.0
[TRACE] 2016-04-10 18:55:43,029 @ qz.printer.action.PrintPixel:?
        Drawable area: 0.0,0.0:8.268001,11.693
[TRACE] 2016-04-10 18:55:43,030 @ qz.printer.action.PrintPixel:?
        [color, 60000x60000 dphi, (0.0,0.0)->(210.007,297.002)mm]
[INFO] 2016-04-10 18:55:43,048 @ qz.printer.action.PrintPixel:?
        Starting printing (10 copies)
[ERROR] 2016-04-10 18:55:54,760 @ qz.ws.PrintSocketClient:?
        Connection error
java.lang.RuntimeException: Cannot call method public void qz.ws.PrintSocketClient#onMessage(org.eclipse.jetty.websocket.api.Session, java.io.Reader) with args: [org.eclipse.jetty.websocket.common.WebSocketSession, org.eclipse.jetty.websocket.common.message.MessageReader]
        at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.unwrapRuntimeException(CallableMethod.java:93)
        at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:75)
        at org.eclipse.jetty.websocket.common.events.annotated.OptionalSessionCallableMethod.call(OptionalSessionCallableMethod.java:68)
        at org.eclipse.jetty.websocket.common.events.JettyAnnotatedEventDriver$2.run(JettyAnnotatedEventDriver.java:210)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.awt.image.DataBufferInt.<init>(Unknown Source)
        at java.awt.image.Raster.createPackedRaster(Unknown Source)
        at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
        at java.awt.image.BufferedImage.<init>(Unknown Source)
        at org.apache.pdfbox.printing.PDFPrintable.print(PDFPrintable.java:169)
        at sun.awt.windows.WPathGraphics.redrawRegion(Unknown Source)
        at sun.print.RasterPrinterJob.printPage(Unknown Source)
        at sun.print.RasterPrinterJob.print(Unknown Source)
        at qz.printer.action.PrintPixel.printCopies(Unknown Source)
        at qz.printer.action.PrintPDF.print(Unknown Source)
        at qz.ws.PrintSocketClient.processPrintRequest(Unknown Source)
        at qz.ws.PrintSocketClient.processMessage(Unknown Source)
        at qz.ws.PrintSocketClient.onMessage(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jetty.websocket.common.events.annotated.CallableMethod.call(CallableMethod.java:70)
        ... 5 more
akberenz commented 8 years ago

@klabarge Can you re-run without the VM args and post the updated logs from (182cce1241d5da196410eb23c7c0cba64dca91ce). I want to know what java is reporting as the default use memory on your system.

Rather, can you run java -XX:+PrintFlagsFinal -version | findstr HeapSize (for windows or | grep HeapSize on linux) from command line and post the results?

klabarge commented 8 years ago

I accidentally closed this... :disappointed: although testing so far has proven to be successful since 64f291dd00b95265e741ffe6afc6f443df338f75

I will leave closed unless we run into another issue.

I was just going to note that launching QZ Tray from the console requires an extra argument from now on:

java -jar -Xms512m "%PROGRAMFILES%\QZ Tray\qz-tray.jar"
tresf commented 8 years ago

Closed via https://github.com/qzind/tray/commit/64f291dd00b95265e741ffe6afc6f443df338f75