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

Synchrony not starting. Fails with error "Failed to get mem_unit from sysinfo."

XMLWordPrintable

      Issue Summary

      After upgrading Confluence to 7.3.3, Synchrony is not getting started and throwing below error in the logs,

      2020-03-20 14:30:29,874 WARN [lifecycle:thread-16] [plugins.synchrony.bootstrap.SynchronyInteropBootstrap] onStart An exception occurred while waiting for Synchrony to start: java.lang.UnsatisfiedLinkError: /home/confluence/.cache/JNA/temp/jna12881934674336678335.tmp: /home/confluence/.cache/JNA/temp/jna12881934674336678335.tmp: failed to map segment from shared object: Operation not permitted
      
      2020-03-20 14:47:11,572 ERROR [Long running task: EnableTask] [confluence.util.longrunning.ConfluenceAbstractLongRunningTask] run Long running task "EnableTask" failed to run.
       -- url: /confluence/rest/synchrony-interop/enable | referer: https://t-conflu-app0.bnppua.net.intra/confluence/admin/confluence-collaborative-editor-plugin/configure.action | traceId: 20f1129098170d20 | userName: admin2
      java.lang.NoClassDefFoundError: Could not initialize class oshi.jna.platform.linux.Libc
      	at oshi.software.os.linux.LinuxOperatingSystem.getProcessId(LinuxOperatingSystem.java:344)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.getConfluenceProcessId(DefaultSynchronyProcessManager.java:702)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.setupEnvironment(DefaultSynchronyProcessManager.java:391)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.trySetup(DefaultSynchronyProcessManager.java:709)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.lambda$startProcess$1(DefaultSynchronyProcessManager.java:603)
      	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
      	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.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)
      2020-03-20 14:49:09,179 ERROR [diagnostics-os-thread] [hardware.platform.linux.LinuxGlobalMemory] <init> Failed to get mem_unit from sysinfo. {}
      java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.platform.linux.LibC$Sysinfo
      	at oshi.hardware.platform.linux.LinuxGlobalMemory.<init>(LinuxGlobalMemory.java:62)
      	at oshi.hardware.platform.linux.LinuxHardwareAbstractionLayer.getMemory(LinuxHardwareAbstractionLayer.java:59)
      	at com.atlassian.confluence.internal.diagnostics.OperatingSystemMonitor.getAvailableMemory(OperatingSystemMonitor.java:211)
      	at com.atlassian.confluence.internal.diagnostics.OperatingSystemMonitor.checkFreeMemory(OperatingSystemMonitor.java:158)
      	at com.atlassian.confluence.internal.diagnostics.OperatingSystemMonitor.lambda$startMonitorThread$1(OperatingSystemMonitor.java:122)
      	at java.base/java.lang.Thread.run(Unknown Source)
      2020-03-20 14:51:09,182 ERROR [diagnostics-os-thread] [hardware.platform.linux.LinuxGlobalMemory] <init> Failed to get mem_unit from sysinfo. {}
      

      Optionally, you may see an error message like this:

       

      2021-09-09 10:28:46,460 WARN [lifecycle:thread-4] [plugins.synchrony.bootstrap.SynchronyInteropBootstrap] onStart An exception occurred while waiting for Synchrony to start: java.lang.UnsatisfiedLinkError: /home/confluence/.cache/JNA/temp/jna10310710589654609994.tmp: /home/confluence/.cache/JNA/temp/jna10310710589654609994.tmp: failed to map segment from shared object: Operation not permitted
      

       

      Steps to Reproduce

      1. Install Confluence for ex: 7.3.3 in the Linux OS where Confluence home is in /home and Confluence install is in /dev .
      2. Mount /home to exec permission using the below command and check the permission after that.
        $ mount --bind /home /home
        $ mount -o remount,exec /home
        


      1. With this Configuration, Synchrony gets started properly.
      2. Now let’s Change /home to noexec using below command, Stop Confluence and execute below command,
        mount -o remount,noexec /home
        

      1. After this change, restart the Confluence

      Expected Results

      Synchrony should start properly without checking mount point permission. Before Confluence 7.1.x , the issue is not reproducible. If the mount has noexec, Synchrony is getting started without any problem.

      Actual Results

      Users are unable to start the Synchrony and getting below error with Confluence version 7.x.x.

      2020-04-04 18:13:12,561 ERROR [StartEventPublisher:thread-1] [hardware.platform.linux.LinuxGlobalMemory] <init> Failed to get mem_unit from sysinfo. {}
      java.lang.UnsatisfiedLinkError: /home/hemant/.cache/JNA/temp/jna40762817292981485.tmp: /home/hemant/.cache/JNA/temp/jna40762817292981485.tmp: failed to map segment from shared object
      	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
      	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1946)
      	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1828)
      2020-04-04 18:14:59,078 ERROR [Long running task: EnableTask] [confluence.util.longrunning.ConfluenceAbstractLongRunningTask] run Long running task "EnableTask" failed to run.
       -- url: /rest/synchrony-interop/enable | referer: http://192.168.1.8:8090/admin/confluence-collaborative-editor-plugin/configure.action | traceId: 80bbe0e1a4d102dd | userName: admin
      java.lang.NoClassDefFoundError: Could not initialize class oshi.jna.platform.linux.Libc
      	at oshi.software.os.linux.LinuxOperatingSystem.getProcessId(LinuxOperatingSystem.java:344)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.getConfluenceProcessId(DefaultSynchronyProcessManager.java:702)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.setupEnvironment(DefaultSynchronyProcessManager.java:391)
      	at com.atlassian.confluence.plugins.synchrony.bootstrap.DefaultSynchronyProcessManager.trySetup(DefaultSynchronyProcessManager.java:709)
      

      Similar issues can be caused if there is not enough space where the JNA temp dir exists:

      WARN [lifecycle:thread-27] [plugins.synchrony.bootstrap.SynchronyInteropBootstrap] onStart An exception occurred while waiting for Synchrony to start: java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library: No space left on device
      
      Caused by: java.lang.UnsatisfiedLinkError: Failed to create temporary file for /com/sun/jna/linux-x86-64/libjnidispatch.so library: No space left on device
      

      Environment

      • Confluence version 7.x onwards
      • Linux / Unix like Operating system

      Notes

      This issue does not usually occur before Confluence 7.1.x versions.

      The issue may happen even if Confluence is not installed under the home folder. This is because the jnidispatch.path is defined under the home folder of the user account that owns the Confluence process. This is where the JNA temp files are located, hence the error on the logs.

      Workaround

      There are 3 workarounds to fix this issue:

      1. Remount /home as exec permission. For this use below command,
        $ mount -o remount,exec /home
        
      2. Transfer Confluence Home directory to another File system which has exec permission.
      3. Or, change the JNA temp dir with the following system property:
        -Djna.tmpdir=<path>

       In addition to remounting, be sure that the ID running the Confluence process has the proper permissions and ownership of the logs, temp, and work subfolders under the installation folder per How to set file system permissions for Confluence - otherwise the same error will appear after startup:

      • sudo chown -R confluenceID <confluence-install-folder>/logs
      • sudo chown -R confluenceID <confluence-install-folder>/work
      • sudo chown -R confluenceID <confluence-install-folder>/temp
      • sudo chmod -R u=rwx,g=rx,o=rx <confluence-install-folder>

              f8dbc9c9ac45 Anshul Chokhani
              hgupta@atlassian.com Hemant Gupta
              Votes:
              10 Vote for this issue
              Watchers:
              33 Start watching this issue

                Created:
                Updated:
                Resolved: