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

Companion app leaks memory if the process is started twice

XMLWordPrintable

      Summary

      The Companion app leaks memory if the process is started twice.

      Issue fixed on Atlassian Companion App version 0.6.0
      1. There will still be two processes running for the Companion app even on 0.6.0.
      2. But there should be only one instance of the app, which can be see with there being only one Companion App icon on the task-bar.

      Environment

      • Only observed on Windows
      • App installed with .msi file

      Steps to Reproduce

      1. Install the Companion app with the .msi file using the following script
        • For 32-bit OS:
          msiexec /qn /i "Atlassian Companion.msi"
          reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run" /v "electron.app.Atlassian Companion" /d "\"C:\Program Files\Atlassian Companion\Atlassian Companion.exe\"" /f
          
        • For 64-bit OS:
          msiexec /qn /i "Atlassian Companion.msi"
          reg add "HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run" /v "electron.app.Atlassian Companion" /d "\"C:\Program Files (x86)\Atlassian Companion\Atlassian Companion.exe\"" /f
          
      1. Reboot the computer

      Expected Results

      The app is started normally and no duplicate processes or memory issues are observed.

      Actual Results

      Duplicate processes for the app are observed, as we can see here:

      One of the processes will leak memory at a rate of around 20 bytes per second. We have some cases where the memory usage reached more than 1GB before the app crashed after running in this situation for a few hours.

      Notes

      The installation method that triggers this situation is a workaround for the following bugs:

      1. https://jira.atlassian.com/browse/CONFSERVER-57792
      2. https://jira.atlassian.com/browse/CONFSERVER-57541

      After running this installation method and rebooting the computer, we end up having two entries on the registry that trigger the app startup, one under the key HKEY_CURRENT_USER and the other under HKEY_LOCAL_MACHINE.

      Even though this is not triggered under normal circumstances, the idea of this bug is that one of the following situations must be avoided:

      1. The app should check if it is already running before starting a new process, or
      2. If the possibility of having two processes is expected, the secondary process should not leak memory

      If the app has one of those protection mechanisms bundled, we exclude the possibility of compromising the end-user computer resources.

      Workaround 1

      Remove one of the registry entries (either from HKLM or HKCU tree), which can be done by an administrator. Only one of the following entries must exist in the registry:

      HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
      
      HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
      

      For a 64 bit OS, the registry tree looks like this:

      HKEY_LOCAL_MACHINE\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Run
      

      Workaround 2

      Uncheck the Launch at startup box on the app itself, which can be done by the end user. This will effectively remove the registry entry from HKEY_CURRENT_USER, but the app will still start automatically on reboot due to the entry under HKEY_LOCAL_MACHINE.

              aknight@atlassian.com Alex K
              bandreeti Bernardo Andreeti
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: