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

Collaborative editing is not working when Java 17 is used and /tmp is noexec

XMLWordPrintable

      Issue Summary

      When Collaborative editing is enabled and Java is updated from version 11 to 17 or 17 is in use, users couldn't edit any pages because of errors in Synchrony. It only happens when /tmp directory is mounted as noexec.

      The issue is caused by bug org.xerial.snappy:snappy-java library, which explains why issue happens - snappy tries to use reflection on private field address from java.nio.Buffer class (see this line in version 1.1.8). Starting form java 16 (see https://openjdk.org/jeps/396), all internal elements are strongly encapsulated, so classes which are not part of the JDK shouldn’t have access to them anymore. This bug was fixed in later versions of snappy library (see release notes for v1.1.9.0), but unfortunately synchrony continue to use version 1.1.8.

      Steps to Reproduce

      Option:1

      1. Install Confluence 8.5.12 with Java 11.
      2. Make sure that the /tmp directory is noexec.
      3. Use another temp directory by using -Djava.io.tmpdir=/var/atlassian/tmp parameter for Confluence.
      4. Create and edit pages and verify that it is successful.
      5. Then change the Java version to 17.
      6. Restart Confluence.
      7. Create and edit pages and check that it is failing.

      Option:2

      1. Install a fresh Confluence with Java 17 bundled.
      2. Make sure that the /tmp directory is noexec.
      3. Use another temp directory by using -Djava.io.tmpdir=/var/atlassian/tmp parameter for Confluence.
      4. Create and edit pages and check that it is failing.

      Expected Results

      Collaborative editing continue to work as usual.

      Actual Results

      The below exception is thrown in the atlassian-synchrony.log file:

      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] 2024-10-24 08:07:51,535 WARN [async-dispatch-16] [synchrony.http.entity-api] Error in put-entity {:entity \"/Synchrony-3aafecce-4154-3a29-a6b7-84ab10d6d7de/confluence-375783430\", :id \"yU0rQV4PAKi0k2yDv6Z1_Q\", :throwable #error {
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :cause \"[UNSUPPORTED_PLATFORM] pure-java snappy requires access to java.nio.Buffer raw address field\"
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :data {:type :server-error, :source :server}
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :via
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t [{:type clojure.lang.ExceptionInfo
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t   :message \"[UNSUPPORTED_PLATFORM] pure-java snappy requires access to java.nio.Buffer raw address field\"
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t   :data {:type :server-error, :source :server}
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t   :at [synchrony.sync.messages$ex_info_from_error_message invokeStatic \"messages.cljc\" 29]}]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :trace
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t [[synchrony.sync.messages$ex_info_from_error_message invokeStatic \"messages.cljc\" 29]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [synchrony.sync.connection$request_BANG_$fn__38749 invoke \"connection.cljc\" 90]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [synchrony.http.entity-api (take?) \"entity_api.clj\" 497]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [synchrony.http.entity_api$content_reconciliation$fn__66754 invoke \"entity_api.clj\" 477]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [synchrony.http.entity-api (take?) \"entity_api.clj\" 541]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [synchrony.http.entity_api$put_revision_handler$fn__67034 invoke \"entity_api.clj\" 521]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [clojure.lang.AFn run \"AFn.java\" 22]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [java.util.concurrent.ThreadPoolExecutor runWorker \"ThreadPoolExecutor.java\" 1136]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [java.util.concurrent.ThreadPoolExecutor$Worker run \"ThreadPoolExecutor.java\" 635]
      2024-10-24 10:07:51,537 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t  [java.lang.Thread run \"Thread.java\" 833]]}}
      ....
      2024-10-24 10:08:23,698 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :cause \"Could not initialize class org.xerial.snappy.pure.UnsafeUtil\"
      2024-10-24 10:08:23,698 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :via
      2024-10-24 10:08:23,698 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t [{:type java.lang.NoClassDefFoundError
      2024-10-24 10:08:23,698 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t   :message \"Could not initialize class org.xerial.snappy.pure.UnsafeUtil\"
      2024-10-24 10:08:23,698 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t   :at [org.xerial.snappy.pure.SnappyRawCompressor writeUncompressedLength \"SnappyRawCompressor.java\" 408]}]
      2024-10-24 10:08:23,698 DEBUG [23830:StdOutHandler [/usr/lib/jvm/java-17-openjdk-17.0.6.0.10-3.el8_7.x86_64/bin/java]] \t :trace 

      Workaround

      Option 1

      1. Add next lines to synchrony-args.properties file
        synchrony.jvm.arg.0=--add-opens=java.base/java.nio=ALL-UNNAMED
        synchrony.jvm.arg.1=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
        synchrony.jvm.arg.2=--add-opens=java.base/sun.nio.cs=ALL-UNNAMED 
      2. Go to General Configuration -> Collaborative editing and press Restart Synchrony button

      Option 2

      If for some reason option 1 doesn't work, try option 2

      1. Add next line to synchrony-args.properties file and add path to another tmp folder, where confluence has access (and which is not mounted with noexec flag).
        synchrony.jvm.arg.0=-Djava.io.tmpdir=/path/to/another/tmp/folder 

        or (either way should work)

        java.io.tmpdir=/path/to/another/tmp/folder 
      2. Go to General Configuration -> Collaborative editing and press Restart Synchrony button

      Option 3

      Follow steps from this KB article - https://confluence.atlassian.com/confkb/confluence-experiences-could-not-initialize-class-org-xerial-snappy-snappy-error-859462192.html

              a9c75a56733b Manonmani Muthukrishnan
              03cb0c04aa4f Irina Tiapchenko
              Votes:
              3 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: