Forking JVM: error=12, Cannot allocate memory or error=12, Not enough space

Troubleshooting Git

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

error=12, Cannot allocate memory (Linux)
com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: java.io.IOException: error=12, Cannot allocate memory
error=12, Not enough space (Solaris)
com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: error=12, Not enough space

原因

If you received error=12, Cannot allocate memory or error=12, Not enough space, this means your system ran out of memory or swap space when Java tried to fork a process. 

The problem is inherent with the way Java allocates memory when executing processes. When Java executes a process, it must fork() then exec(). Forking creates a child process by duplicating the current process. By duplicating the current process, the new child process will request approximately the same amount of memory as its parent process, essentially doubling the memory required. However, this does not mean all the memory allocated will be used, as exec() is immediately called to execute the different code within the child process, freeing up this memory. As an example, when Stash tries to locate git, the Stash JVM process must be forked, approximately doubling the memory required by Stash.

Note that this issue is made worse by hosting multiple webapps in the same Tomcat container as Stash (which is not supported), because more memory is used by the Java process. 

Please see Forking JVM for a more detailed explanation.

ソリューション

If you are hosting multiple products in the same Tomcat container as Stash, move Stash to its own Tomcat container.

For Linux, this can be resolved by enabling over-committing memory (see option 3 of Forking JVM).

For Solaris, we recommend increasing your swap space. How much swap space do you need? This will also depend on the other applications running on the same machine. We recommend allocating at least swap equal to 4 x JVM_MAXIMUM_MEMORY, or 2 x PHYSICAL RAM, whichever is larger. The JVM_MAXIMUM_MEMORY is set in your  <Stash installation directory>/bin/setenv.sh.  You can increase your swap space if you are still running out of memory.

 

 

 

 

 

 

 

 

 


最終更新日 2018 年 11 月 2 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.