'Not enough storage is available to process this command' thrown when using jstack to generate external thread dumps
Problem
You may be instructed by Atlassian Support to generate a thread dump using the jstack tool on a Windows platform. This error is thrown when trying to execute the command.
Cause
Jstack only allows you to connect to JVM's running in the same user context. Many people use a service wrapper to start their products: this puts the JVM in the Local System Account user context. Since this special account has no login shell, you won't be able to force a thread dump normally.
Workaround
Workaround 1:
Change the service wrapper to use another account. Do this from Services>Apache Tomcat Confluence>Properties.
Workaround 2:
Use Psexec to execute the jstack command as the relevant user.
psexec -s "%JAVA_HOME%\bin\jstack.exe" PID >stack.txt
Workaround 3:
Follow the Live Monitoring Using the JMX Interface directions and set up a JMX monitoring tool like visualVM acting remotely on the JVM. Many of these tools can generate thread dumps externally.