Editor fails to load in Confluence 6.x and later due to 'Could not initialize class org.xerial.snappy.Snappy' error

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform Notice: Server and Data Center Only - This article only applies to Atlassian products on the server and data center platforms.

Problem

In Confluence 6.x and later, you can't create new pages or edit existing ones due to the editor not loading. We see an error in the top right of the page editor.

Looking into atlassian-synchrony.log, we can see the following errors:

java.lang.NoClassDefFoundError: Could not initialize class org.xerial.snappy.Snappy
java.lang.UnsatisfiedLinkError: /tmp/snappy-1.1.0.1-f08e07cc-9064-42a4-9af9-b062417b146f-libsnappyjava.so: /tmp/snappy-1.1.0.1-f08e07cc-9064-42a4-9af9-b062417b146f-libsnappyjava.so: failed to map segment from shared object
clojure.lang.ExceptionInfo: Could not initialize class org.xerial.snappy.Snappy {:type :server-error, :source :server}

Diagnosis

Environment

Confluence is hosted in any of the following operating systems:

  • Debian
  • CentOS
  • Ubuntu
  • Red Hat Enterprise Linux
  • Alpine Linux

Diagnostic Steps

The troubleshooting steps below have been applied but the issue still persists:

  • Restarting Synchrony.
  • Switching the Collaborative Editing mode to "Off" then back to "On".
  • (If applicable) The reverse proxy configuration has already been set correctly as described in our documentation.

On top of that, the /tmp partition in the server is mounted as noexec. This can be checked by running this command on the server's terminal:

mount | grep /tmp

You should see results similar to the following, which confirms that /tmp has been mounted as noexec:

/dev/sda7 on /tmp type ext4 (rw,noexec,nosuid)

Cause

The root cause of this issue lies in the operating system's mount point(s), whereby the /tmp partition has been mounted as noexec. Mounting a filesystem as noexec means it does not permit the execution of executable binaries in the mounted filesystem.

Resolution 1

The /tmp partition needs to be remounted as exec. Please contact your Linux administrator so they can perform this fix. The simple command below can also be used to remount the partition and resolve the issue:

mount -o remount,exec /tmp

Or, if you do not allow /tmp to be mounted with exec permissions, you can add the following argument to the <confluence-home>/synchrony-args.properties file (or create a file named that with the following argument). Please note that this does not always work due to this bug CONF-51900 - Getting issue details... STATUS  and the solution above may be required.

java.io.tmpdir=/path/to/your/own/temp/directory

Make sure that /path/to/your/own/temp/directory is owned by the operating system user account that runs Confluence.

(info) In either case, please be sure to restart the Synchrony service so that Synchrony picks up this change:

  1. Log into the admin console > General Configuration > Collaborative Editing
  2. Click the Restart Synchrony button.
For Confluence Data Center:

The synchrony-args.properties  file is not used in Confluence Data Center below version 6.12. Instead, you will need to add the "-Djava.io.tmpdir= /path/to/your/own/temp/directory" parameter as a flag to the startup command on each Synchrony node if you run Synchrony in standalone mode.

java -Xss2048k -Xmx2g -classpath /path/to/synchrony-standalone.jar:/path/to/postgresql-9.4.1212.jar -Dsynchrony.cluster.impl=hazelcast-btf -Dsynchrony.port=8091 -Dcluster.listen.port=5701 -Dsynchrony.cluster.base.port=25500 -Dcluster.join.type=tcpip -Dcluster.join.tcpip.members=127.0.0.1 -Dsynchrony.context.path=/synchrony -Dsynchrony.cluster.bind=127.0.0.1 -Dsynchrony.bind=localhost -Dcluster.interfaces=127.0.0.1 -Dsynchrony.service.url=http://localhost:8091/synchrony/v1 -Djwt.private.key=MIICdgY2G6An3vWgL1/i/1V+lt7ffaX/iXZZ4RxwnO5OWmVm7FKE4HZBuw21xmH3MBCHqu+xb8Zpg1N3HKkKOHxCUVzhaAssD/qLJnnWnvbz3k7wmQV7N5ySLAgMBAAECgYBqCUehOSMbSJgYxk5loXDLJxJdPIpaZmwyXFUvtyG3yjwp4HS3YxQn4bavMmCpxFHEJM4gnfp1iJ4YNM4QwmSge3AocWgSK9hyGoqVtO0w8LXRw2bUdRWreJV86LUtzX49H5VyV0arQSF7gbb9J4nzCyvxd6Y1938uN27IZ8SoMQJBAOuGxYXNTON48sfbVJpVyqAKD63kIfCIk15AERSVWggM -Djwt.public.key=MIGfMA0GCSqGSIb3DQEBAQUAA4Gadsfl123SPYzRTGJATGhZxA6kDhWNhugJ971oC9f4v9Vfpbe332l/4l2WeEccJzuTlplZuxShOB2QbsNtcZh9zAQh6rvsW/GaYNTdxypCjh8QlFc4WgLLA/6iyZ51p72895O8JkFezeckiwIDAQAB -Dsynchrony.database.url=jdbc:postgresql://localhost:5432/confluence -Dsynchrony.database.username=confuser -Dsynchrony.database.password=confuser -Dip.whitelist=127.0.0.1,localhost -Djava.io.tmpdir=/path/to/your/own/temp/directory synchrony.core sql

To understand each Synchrony mode and which one of them are you using, check the guide below:

Resolution 2

Alpine Linux distribution by default will not have libc6-compat package installed, which provides the symlinks for libc.so.6 / libm.so.6. Check if the package is installed and if not install it.

apk add libc6-compat

Please note that Alpine Linux is not supported by Atlassian as mentioned in Supported Platforms. We have a feature request for that:

CONFSERVER-52400 - Getting issue details... STATUS

Notes

This problem may also occur when migrating from Linux to Windows. After the first startup on the new server, the following error can be seen in the atlassian-synchrony.log:

{"synchrony":{"entity":"/Mesirow-Financial-afa0320d-c0c7-3fcf-973e-38159f4035d0/confluence-17171501","ns":"synchrony.sync.hub","level":"warn","throwable":"java.lang.UnsatisfiedLinkError: /tmp/snappy-1.1.0.1-cc895952-7b1a-4dad-aa7d-c51ee5bf9595-libsnappyjava.so: /tmp/snappy-1.1.0.1-cc895952-7b1a-4dad-aa7d-c51ee5bf9595-libsnappyjava.so: failed to map segment from shared object: Operation not permitted
...
{"synchrony":{"message":"synchrony.http.entity-api [warn] Error in put-entity","entity":"/Synchrony-ec07ec53-37cb-3637-be42-10a55a8b6b18/confluence-3736095","ns":"synchrony.http.entity-api","level":"warn","throwable":"clojure.lang.ExceptionInfo: Could not initialize class org.xerial.snappy.Snappy

As we can see, Synchrony is still looking into /tmp directory for the snappy file. To refresh the directory, we need to pass a new valid path to the synchrony-args.properties file as in the following example and restart Synchrony:

java.io.tmpdir=C:\\Progra~1\\Atlassian\\Confluence\\temp

We need to escape the path as in the example above otherwise it will not be picked up correctly by Synchrony.

Description

In Confluence 6.x and later, you can't create new pages or edit existing ones due to the editor not loading. We see an error in the top right of the page editor. This page covers the resolutions to this issue.

ProductConfluence
Last modified on May 7, 2020

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.