Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-97830

Previewing excel files fails due to java.awt.AWTError

XMLWordPrintable

      Problem

      Excel macro fails to render Excel files.

      Environment

      Reproducible in:

       7.19
       8.5.14

      Not reproducible in:

      8.7.1

      Steps to Reproduce

      • On a Linux operating system set the system variable "DISPLAY".
      • On a page add an Excel file and try to preview it with Excel macro.

      Expected Results

      You should be able to see the Excel file.

      Actual Results

      You should be able to see the Excel file.

      Diagnosis

      Reviewing the logs, the following error is found when trying to add the excel macro:

      atlassian-confluence.log
      2024-08-24 09:32:18,494 WARN [ForkJoinPool.commonPool-worker-9] [plugins.conversion.impl.LocalFileSystemConversionResultSupplier] lambda$performConversionInSandbox$2 Error when performing conversion com.atlassian.confluence.plugins.conversion.impl.LocalFileSystemConversionResultSupplier$3@46f0ffee[attachment=/download/attachments/314424259/testing.xlsx?version=1&modificationDate=1724509933437&api=v2,conversionType=THUMBNAIL] in the sandbox
       -- url: / | traceId: b3ebad88c538b44a | userName: xxxxx
      java.util.concurrent.CompletionException: com.atlassian.confluence.util.sandbox.SandboxCrashedException: Sandbox has crashed while serving the request
      	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
      	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
      	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      	at java.base/java.lang.Thread.run(Unknown Source)
      Caused by: com.atlassian.confluence.util.sandbox.SandboxCrashedException: Sandbox has crashed while serving the request
      	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.tryToThrowSpecificException(SandboxProcess.java:174)
      	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:139)
      	at com.atlassian.confluence.impl.util.sandbox.SandboxLocalProcessPool.execute(SandboxLocalProcessPool.java:107)
      	at com.atlassian.confluence.impl.util.sandbox.ConfluenceSandboxPoolFactory$LazySandbox.execute(ConfluenceSandboxPoolFactory.java:70)
      	at com.atlassian.confluence.impl.util.sandbox.DefaultSandbox.execute(DefaultSandbox.java:41)
      	at com.atlassian.confluence.plugins.conversion.impl.sandbox.LocalDocumentConversionSandbox.execute(LocalDocumentConversionSandbox.java:66)
      	at com.atlassian.confluence.plugins.conversion.impl.sandbox.LocalDocumentConversionSandbox.execute(LocalDocumentConversionSandbox.java:59)
      	at com.atlassian.confluence.plugins.conversion.impl.sandbox.DelegatingDocumentConversionSandbox.execute(DelegatingDocumentConversionSandbox.java:47)
      	at com.atlassian.confluence.plugins.conversion.impl.LocalFileSystemConversionResultSupplier.lambda$performConversionInSandbox$1(LocalFileSystemConversionResultSupplier.java:224)
      	... 4 more
      Caused by: java.io.EOFException
      	at java.base/java.io.DataInputStream.readInt(Unknown Source)
      	at com.atlassian.confluence.impl.util.sandbox.SandboxMessage.receiveMessage(SandboxMessage.java:43)
      	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.receiveMessage(SandboxProcess.java:227)
      	at com.atlassian.confluence.impl.util.sandbox.SandboxProcess.execute(SandboxProcess.java:136)
      	... 11 more 

      To get more details, please add the Sandbox class to debug:

      com.atlassian.confluence.impl.util.sandbox 

      During testing, it was noticed two outputs in atlassian-confluence.log .

      • If the Linux OS doesn't have the following libs libxrender1, libxtst6, libxi6, the sandbox errors out like this: 
      2024-09-02 14:29:32,522 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker0: Exception in thread \"main\" java.lang.UnsatisfiedLinkError: /opt/java/openjdk/lib/libawt_xawt.so: libXext.so.6: cannot open shared object file: No such file or directory  
      • After installing the libs, it will error out like this: 
      2024-09-02 14:04:44,446 DEBUG [http-nio-8090-exec-11 url: /confluence/rest/office/1.0/view; user: admin] [impl.util.sandbox.SandboxClassFinder] findClass Attempt to load class com.aspose.cells.a.c.zh
      2024-09-02 14:04:44,501 INFO [sandbox-logger] [impl.util.sandbox.ConversionSandbox] lambda$buildConfig$0 worker1: Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.  

      Cause

      The Sandbox can inadvertently pick up the DISPLAY environment variable and try to use it. For more information on what this variable is, please refer to the link below:

      Reviewing the support zip, the variable can be found in the application.xml file:

      application.xml
      <environment-variables>
      ...
          <DISPLAY>localhost:10.0</DISPLAY>
      ...
      </environment-variables>
      

      Workaround

      Try unsetting the DISPLAY variable on the Confluence side:

      1. Locate the and edit the <confluence_installation>/bin/setenv.sh file
      2. Add at the end of the file
        unset DISPLAY
        
      3. Restart Confluence on this node
      4. Wait for this node to fully start up, then apply the same changes to any additional Confluence DC nodes
      5. Once all nodes have the DISPLAY environment cleared out in setenv.sh, try the excel macro again

      Notes

              20f00d30f8b9 Franco Skrzypczak (Inactive)
              f7fe77b3bc24 Filipe Rodrigues
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: