JCEF sporadically doesn't print PDF

Having problems with building or using the JCEF Java binding? Ask your questions here.

JCEF sporadically doesn't print PDF

Postby Phylanx » Mon Jul 19, 2021 8:55 am

Hi!

We have installed our JCEF Upgrade to version 4147 to our customers system and it seems we could establish a stable state.
But now the customer reported a problem that sometimes PDFs are not printed.

The usecase is the following:
The PDF is viewed in a browser via file URL
The users clicks on the print icon in the upper right
the brand new printing dialog of chrome is displayed (with the --enable-print-preview setting)
user presses print
nothing happens.

In our JCEF client logs we found the following error logs:
Code: Select all
[0507/092115.646:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092115.648:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092115.648:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092115.649:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092115.654:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092115.654:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.335:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092142.335:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092142.335:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.335:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092142.336:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.659:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092159.659:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092159.659:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.659:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.659:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092159.659:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092159.659:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.659:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.660:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092159.660:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092159.660:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.660:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.660:ERROR:shared_image_manager.cc(188)] SharedImageManager::ProduceGLTexturePassthrough: Trying to produce a representation from a non-existent mailbox.
[0507/092159.660:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: invalid mailbox name.
[0507/092159.660:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image
[0507/092159.660:ERROR:gl_utils.cc(316)] [.DisplayCompositor] GL_INVALID_OPERATION: texture is not a shared image


Can this be the reason for it?
If yes, what does it mean?

Thx in advance!
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: JCEF sporadically doesn't print PDF

Postby Phylanx » Tue Jul 20, 2021 12:41 am

We got more detailed informations of our customer.

The problem occurs everytime they want to print PDFs.
Also the logging I've provided in the first post is irrelevant, the problem exists also without this logging.

Other error loggings we see (see attached jcef.log with activated VERBOSE logging):
[*] [0630/062919.777:ERROR:viz_main_impl.cc(150)] Exiting GPU process due to errors during initialization
[*] [0630/062919.888:ERROR:browser_gpu_channel_host_factory.cc(153)] Failed to launch GPU process.
[*] many many times: [0630/062920.050:ERROR:paint_controller.cc(647)] PaintController::FinishCycle() completed
but these logs we see always.

Printing in general works. We use JCEF to display the PDFs, the printing in JCEF doesn't work but if the user tries to print directly in our program (via java.awt.print.PrinterJob) that works.
Also if we print this PDF via "Microsoft PDF Printer" it always works.
But if printing against a "OneNote" printer that does not work.

Is there some additional logging we can activate or some other resource we can activate to gain more information?
Attachments
JCEF.log
(338.12 KiB) Downloaded 375 times
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: JCEF sporadically doesn't print PDF

Postby Phylanx » Tue Jul 20, 2021 9:01 am

Again some news:

We could reproduce the problem internally.
It seems to have to do something with the native memory available.

Tests done with AdoptOpenJDK jdk1.8.0_275, 32bit on a win10, Version 20H2, 16GB RAM
Test printer is the Windows PDF Printer and an Epson EcoTank 2650.

If we start our test application with -Xmx512m the PDF is printed as expected.
Starting the application with -Xmx768m (as at the customers; there the native memory is also more limited with more threads and other native code running) printing the PDF results in a white PDF result with the pdf printer, the physical printing works.
If starting with Xmx1024m a 0MB PDF is "printed" and on the physical printer nothing happens.

The PDF consists of 6 pages with a scanned document that I can't share for patients privacy reasons (it is a consent form for a surgery).
The scanned images are rather huge (about 4 times bigger than A4) and are only printable if "fit in page" is selected (but printing doesn't work in both cases, with and without fit in page).

I can remember that we had a bug once that sounds very similar to this one.
In version 2704 ImageMasks and Images with Transparancy created a huge EMF file when printing (512MB resulting from a 10kb PDF) that crashed the application with an OutOfMemory Error.
If I remember correctly we disabled printing with Bitmaps then and that was our working solution...

Now the application does not crash but can it be this problem again?

//EDIT: Also checked behaviour with newest JCEF Version available and it is the same.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am

Re: JCEF sporadically doesn't print PDF

Postby Phylanx » Mon Jul 26, 2021 1:10 am

After some additional tests and tryouts we found a solution.

As feared it is - again - the problem with pdfiums print rendering of image masks and background alpha logic.
See also viewtopic.php?f=17&t=14829 for our first problem with it (it was back in version 2704 then).

Problematic code is lying here:
https://pdfium.googlesource.com/pdfium/ ... ew.cpp#457

Just to be clear, the code itself is not wrong. It just needs too much memory in our special environment (32 bit JDK, only very rare memory is left for native part of JVM).
If we had 64 bit it would be no problem.

For all others having the same issue:
Our fix is to hard coded set bNewBitmap and bHasMask to false on before the if (!bNewBitmap && !bHasMask).
This ensures the problematic code is not executed.

We had no side effects by now, but I'm not sure if our customers use PDFs with all technical possibilities of the PDF format.

Thread can be closed.
Phylanx
Expert
 
Posts: 201
Joined: Thu Aug 11, 2016 8:17 am


Return to JCEF Forum

Who is online

Users browsing this forum: No registered users and 4 guests

cron