PDF-Export Application Problem (Experimental PDF-Export with Docker)

Hey folks,

i am fiddling around with the new experimental PDF-Export Application. Problem is: Failure in Docker-Container, when exporting an PDF.

  • Docker Container is starting, automatically
  • Docker Container is not reused
  • Client-Side Export is working well

Failure Log of Container:

DevTools listening on ws://0.0.0.0:9222/devtools/browser/6d8f7c74-bf7c-4794-8645-7ed6dac19918 [0819/074613.837888:ERROR:gl_factory.cc(128)] Requested GL implementation (gl=none,angle=none) not found in allowed implementations: [(gl=egl-angle,angle=default),(gl=egl-gles2,angle=none),(gl=egl-angle,angle=swiftshader)].

[0819/074613.842176:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization [0819/074613.856909:ERROR:gl_factory.cc(128)] Requested GL implementation (gl=none,angle=none) not found in allowed implementations: [(gl=egl-angle,angle=default),(gl=egl-gles2,angle=none),(gl=egl-angle,angle=swiftshader)].

[0819/074613.866434:ERROR:viz_main_impl.cc(186)] Exiting GPU process due to errors during initialization [0819/074613.877342:ERROR:gpu_init.cc(481)] Passthrough is not supported, GL is disabled, ANGLE is [0819/074613.932067:WARNING:dns_config_service_linux.cc(428)] Failed to read DnsConfig.

Is there any place where i can inject and try the Chromium Flag --no-gpu?

Help is appreciated :slight_smile:

Thanks for the feedback.

We use the zenika/alpine-chrome:latest docker image by default and AFAICS at https://github.com/xwiki/xwiki-platform/blob/7eb067e557abd891c1d75cb6e0ef4ee12e681866/xwiki-platform-core/xwiki-platform-export/xwiki-platform-export-pdf/xwiki-platform-export-pdf-default/src/main/java/org/xwiki/export/pdf/internal/chrome/ChromeManagerProvider.java#L104-L108 there’s no way to pass new container startup options.

Thus, what you could do is configure the extension to not start the image automatically and instead start it manually (and reuse it probably). Then you should be able to use the --disable-gpu option from “How to use with WebGL” at Docker Hub

Let us know if it works. It could be an improvement to add a configuration to pass additional “docker run” options.

Thx

PS: Would be interesting to understand why you get these errors on your system since disabling the gpu is probably not the best.

It would be very helpful to know exactly what we need to install to get PDF Export working.
A step by step description would be great.
The documentation is at least for me not obvious that you also need zenika/alpine-chrome:latest.

As described in my post, I also tried to install PDF inside Docker and failed, as before.

Best thanks

Thank you!

I’ve looked through the Docker Hub page and there it is: --disalbe-gpu is already set in the default entrypoint. So perhaps I have to enable it…

If I figure it out I let the community know what is going wrong here :slight_smile:

If the docker container runs on the same host as xwiki and xwiki is NOT itself in a container:

  1. Install Docker
  2. Add your tomcat-User (tomcat9?) to the docker group to allow starting and stopping a container
  3. pull the image once (zenika/alpine-chrome:latest)
  4. add the config from the extension page to xwiki.properties (as provided)
  5. install the extension in the XWiki administration
  6. Restart tomcat

If the docker container runs on the same host as xwiki and xwiki is itself in a container:

  1. pull the image once (zenika/alpine-chrome:latest)
  2. add the config from the extension page to xwiki.properties and
    2.1 specify the host that the Chrome container can use to access XWiki. (IP or Name of the XWiki Container)
    2.2 Set export.pdf.dockerNetwork=bridge to the network the xwiki-container is running in
  3. install the extension
  4. Restart the xwiki docker container

Does this help you?

(There is a third option where xwiki and headless-chrome docker container run on different machines. But for this please adapt the steps above and add ip addresses to the config )

Hi @TheBob , see PDF Export Application (XWiki.org) for the different requirements to get it working.

We’re planning to remove that default Docker requirement in the future so that it works OOB without any configuration change, and explaining to Admin users how to set it up using docker if they need that.

Note that this extension is currently experimental, see PDF Export Application (XWiki.org)

what post?

Thanks

you don’t need that, xwiki does it by itself in managed mode (the default mode).

you also don’t need that, unless you want to change the default config.

1 Like

Only if you want to use the docker mode.

You shouldn’t need to do that either.

Basically all you need to do if you’re using the default mode (no config change) is what is described at PDF Export Application (XWiki.org)

1 Like

No Restart required after changing something in xwiki.properties?

With “docker mode”: Do you mean server-side generation of the pdf?

For an unknown reason it did not do the first pull. Starting and stopping works fine though.

The only reason I see to change xwiki.properties is if you don’t want to use the default mode.

1 Like

I mean the mode that is not using docker, i.e. PDF Export Application (XWiki.org)

That’s weird and should be reported since it would be a bug. Maybe you could try again? Could it be that you didn’t let it enough time to do the pull and stopped xwiki before it could finish?

Sure, i can try it again at the weekend. Good question. I can’t say if I have waited long enough :sweat_smile:

Hello to you both,
I have tested both, with and without docker. One is installed on my Synology with docker and I test it like you described it @jwielsch. (everything internal Docker)
I test with changing xwiki.porperties or not and installing zenika/alpine-chrome:latest or not.
I get this error on Docker Versions:

cat log.xml 
<org.xwiki.logging.event.BeginLogEvent>
  <marker class="org.xwiki.logging.marker.BeginTranslationMarker">
    <name>job.log.beginWithId</name>
    <references class="linked-hash-set">
      <org.slf4j.helpers.BasicMarker>
        <name>xwiki.begin</name>
        <referenceList class="java.util.concurrent.CopyOnWriteArrayList" serialization="custom">
          <java.util.concurrent.CopyOnWriteArrayList>
            <default/>
            <int>0</int>
          </java.util.concurrent.CopyOnWriteArrayList>
        </referenceList>
      </org.slf4j.helpers.BasicMarker>
    </references>
    <translationKey>job.log.beginWithId</translationKey>
  </marker>
  <message>Starting job of type [{}] with identifier [{}]</message>
  <argumentArray>
    <string>export/pdf</string>
    <java.util.Arrays_-ArrayList>
      <a class="string-array">
        <string>export</string>
        <string>pdf</string>
        <string>1661329242452-786</string>
      </a>
    </java.util.Arrays_-ArrayList>
  </argumentArray>
  <level>INFO</level>
  <timeStamp>1661329242466</timeStamp>
</org.xwiki.logging.event.BeginLogEvent>
<org.xwiki.logging.event.LogEvent>
  <level>ERROR</level>
  <timeStamp>1661329252514</timeStamp>
  <message>Exception thrown during job execution</message>
  <marker class="org.xwiki.logging.marker.TranslationMarker">
    <name>xwiki.translation</name>
    <translationKey>job.log.exception</translationKey>
  </marker>
  <throwable class="java.lang.RuntimeException">
    <detailMessage>Failed to get [role = [org.xwiki.export.pdf.PDFPrinter&lt;java.net.URL&gt;] hint = [docker]]</detailMessage>
    <cause class="org.xwiki.component.manager.ComponentLookupException">
      <detailMessage>Failed to lookup component [org.xwiki.export.pdf.internal.docker.DockerPDFPrinter] identified by type [org.xwiki.export.pdf.PDFPrinter&lt;java.net.URL&gt;] and hint [docker]</detailMessage>
      <cause class="org.xwiki.component.phase.InitializationException">
        <detailMessage>Failed to initialize the Chrome remote debugging service.</detailMessage>
        <cause class="java.util.concurrent.TimeoutException">
          <detailMessage>Timeout waiting for Chrome remote debugging to become available. Waited [10] seconds.</detailMessage>
          <stackTrace>
            <trace>org.xwiki.export.pdf.internal.chrome.ChromeManager.waitForChromeService(ChromeManager.java:166)</trace>
            <trace>org.xwiki.export.pdf.internal.chrome.ChromeManager.connect(ChromeManager.java:136)</trace>
            <trace>org.xwiki.export.pdf.internal.docker.DockerPDFPrinter.initializeChromeService(DockerPDFPrinter.java:135)</trace>
            <trace>org.xwiki.export.pdf.internal.docker.DockerPDFPrinter.initialize(DockerPDFPrinter.java:95)</trace>
            <trace>org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)</trace>
            <trace>org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)</trace>
            <trace>org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)</trace>
            <trace>org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)</trace>
            <trace>org.xwiki.component.embed.GenericProvider.getInstance(GenericProvider.java:111)</trace>
            <trace>org.xwiki.component.embed.GenericProvider.get(GenericProvider.java:100)</trace>
            <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.saveAsPDF(PDFExportJob.java:162)</trace>
            <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.runInternal(PDFExportJob.java:115)</trace>
            <trace>org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:243)</trace>
            <trace>org.xwiki.job.AbstractJob.run(AbstractJob.java:220)</trace>
            <trace>java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</trace>
            <trace>java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</trace>
            <trace>java.base/java.lang.Thread.run(Unknown Source)</trace>
          </stackTrace>
        </cause>
        <stackTrace>
          <trace>org.xwiki.export.pdf.internal.docker.DockerPDFPrinter.initializeChromeService(DockerPDFPrinter.java:137)</trace>
          <trace>org.xwiki.export.pdf.internal.docker.DockerPDFPrinter.initialize(DockerPDFPrinter.java:95)</trace>
          <trace>org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)</trace>
          <trace>org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:365)</trace>
          <trace>org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:451)</trace>
          <trace>org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:201)</trace>
          <trace>org.xwiki.component.embed.GenericProvider.getInstance(GenericProvider.java:111)</trace>
          <trace>org.xwiki.component.embed.GenericProvider.get(GenericProvider.java:100)</trace>
          <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.saveAsPDF(PDFExportJob.java:162)</trace>
          <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.runInternal(PDFExportJob.java:115)</trace>
          <trace>org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:243)</trace>
          <trace>org.xwiki.job.AbstractJob.run(AbstractJob.java:220)</trace>
          <trace>java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</trace>
          <trace>java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</trace>
          <trace>java.base/java.lang.Thread.run(Unknown Source)</trace>
        </stackTrace>
      </cause>
      <stackTrace>
        <trace>org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:204)</trace>
        <trace>org.xwiki.component.embed.GenericProvider.getInstance(GenericProvider.java:111)</trace>
        <trace>org.xwiki.component.embed.GenericProvider.get(GenericProvider.java:100)</trace>
        <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.saveAsPDF(PDFExportJob.java:162)</trace>
        <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.runInternal(PDFExportJob.java:115)</trace>
        <trace>org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:243)</trace>
        <trace>org.xwiki.job.AbstractJob.run(AbstractJob.java:220)</trace>
        <trace>java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</trace>
        <trace>java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</trace>
        <trace>java.base/java.lang.Thread.run(Unknown Source)</trace>
      </stackTrace>
    </cause>
    <stackTrace>
      <trace>org.xwiki.component.embed.GenericProvider.get(GenericProvider.java:103)</trace>
      <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.saveAsPDF(PDFExportJob.java:162)</trace>
      <trace>org.xwiki.export.pdf.internal.job.PDFExportJob.runInternal(PDFExportJob.java:115)</trace>
      <trace>org.xwiki.job.AbstractJob.runInContext(AbstractJob.java:243)</trace>
      <trace>org.xwiki.job.AbstractJob.run(AbstractJob.java:220)</trace>
      <trace>java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)</trace>
      <trace>java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)</trace>
      <trace>java.base/java.lang.Thread.run(Unknown Source)</trace>
    </stackTrace>
  </throwable>
</org.xwiki.logging.event.LogEvent>
<org.xwiki.logging.event.EndLogEvent>
  <marker class="org.xwiki.logging.marker.EndTranslationMarker">
    <name>job.log.endWithId</name>
    <references class="linked-hash-set">
      <org.slf4j.helpers.BasicMarker>
        <name>xwiki.end</name>
        <referenceList class="java.util.concurrent.CopyOnWriteArrayList" serialization="custom">
          <java.util.concurrent.CopyOnWriteArrayList>
            <default/>
            <int>0</int>
          </java.util.concurrent.CopyOnWriteArrayList>
        </referenceList>
      </org.slf4j.helpers.BasicMarker>
    </references>
    <translationKey>job.log.endWithId</translationKey>
  </marker>
  <message>Finished job of type [{}] with identifier [{}]</message>
  <argumentArray>
    <string>export/pdf</string>
    <java.util.Arrays_-ArrayList>
      <a class="string-array">
        <string>export</string>
        <string>pdf</string>
        <string>1661329242452-786</string>
      </a>
    </java.util.Arrays_-ArrayList>
  </argumentArray>
  <level>INFO</level>
  <timeStamp>1661329252520</timeStamp>
</org.xwiki.logging.event.EndLogEvent>

And the other test is under Ubuntu 20.04 without docker I described in my early post: PDF Template - Content of Page based on encyclopaedia

I know that it is experimental, and I would like to test it to help you.
I can wait for a new version and test it again.

Many thanks in advance
TheBob

This is the root cause but we need to understand why. I’ve added some debug logs for XWiki 14.7+: [Misc] Add debug information to better understand the timeout cause · xwiki/xwiki-platform@7f27e56 · GitHub

I haven’t worked on this code and @mflorea is the best person to help on this. It could be a bug that would need reporting in jira.