Java Jstack 并且没有足够的存储空间来处理此命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/906620/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 20:55:08  来源:igfitidea点击:

Jstack and Not enough storage is available to process this command

javajstack

提问by tropikalista

I'm trying to run jstack command on my java application. Application is rather big, running inside jboss AS occupying about 4gb of memory. OS is Windows Server 2003 Standard edition. Every time i get an error "Not enough storage is available to process this command". There is enough ram, 16gb, and disk space. So, any ideas?

我正在尝试在我的 Java 应用程序上运行 jstack 命令。应用比较大,运行在jboss AS里面,占用大约4GB内存。操作系统是 Windows Server 2003 标准版。每次我收到错误“没有足够的存储空间来处理此命令”。有足够的内存、16GB 和磁盘空间。那么,有什么想法吗?

采纳答案by Eric McNeill

I ran into this recently on Win2008r2 and thought I'd share my solution since it took a while to figure out. Rob's comment about psexec -sis what did it for me.

我最近在 Win2008r2 上遇到了这个问题,我想我会分享我的解决方案,因为花了一段时间才弄清楚。Rob 对 psexec -s 的评论对我有用

It appears that on Vista and later jstack doesn't work against services because of the user context. It has nothing to do with memory. I suspect this is the same reason people have seen this problem on 2003 via remote desktop, unless you use the /admin or /console switch on mstsc. As of Vista the tightened security is probably what broke it.

由于用户上下文,似乎在 Vista 和更高版本上 jstack 不适用于服务。它与内存无关。我怀疑这与人们在 2003 年通过远程桌面看到此问题的原因相同,除非您在 mstsc 上使用 /admin 或 /console 开关。从 Vista 开始,加强的安全性可能是破坏它的原因。

Starting my app from a cmd window worked fine, but that doesn't help me debug our standard install. Enabling the java debug port (for VisualVM, Eclipse or most any Java debugger) requires an app restart, so you lose the state you're probably trying to capture if you don't already have debugging enabled. Starting the service under my user credentials did not work - I was a little surprised at that. But psexec -s runs jstack from the system context, which worked like a charm. Oh, and you'll need to run psexec from an elevated cmd prompt, if UAC is on.

从 cmd 窗口启动我的应用程序工作正常,但这并不能帮助我调试我们的标准安装。启用 Java 调试端口(对于 VisualVM、Eclipse 或大多数 Java 调试器)需要重新启动应用程序,因此如果您尚未启用调试,您可能会丢失您可能尝试捕获的状态。在我的用户凭据下启动服务不起作用 - 我对此感到有些惊讶。但是 psexec -s 从系统上下文运行 jstack,它的作用就像一个魅力。哦,如果 UAC 已打开,您将需要从提升的 cmd 提示符运行 psexec。

回答by Fortyrunner

We had problems running JStack on a Windows machine with even a modest application (1GB). We ended up doing our stack and heap analysis using Netbeans. This seemed to cope with the parsing of dump files a lot better. YMMV.

我们在 Windows 机器上运行 JStack 时遇到了问题,即使是一个适度的应用程序 (1GB)。我们最终使用 Netbeans 进行了堆栈和堆分析。这似乎更好地处理转储文件的解析。天啊。

Give Netbeans a try for profiling - its very good. Note that VisualVM is a cutdown NB profiler and comes with 6u7.

尝试对 Netbeans 进行分析 - 它非常好。请注意,VisualVM 是一个精简的 NB 分析器,并带有 6u7。

回答by Rob Tanzola

In the past I have seen this when the JVM is running as a Windows Service on Windows 2003.

过去,当 JVM 作为 Windows 2003 上的 Windows 服务运行时,我曾见过这种情况。

First, check to see if this is an issue with the TMP directory.

首先,检查这是否是TMP 目录问题

Second, jstack (or the other utilities like jconsole) will not connect to the local process unless it is running in the same session. If the service is running as a specific user, you may be able to connect by logging into the same session. If you are using Remote Desktop, you can connect using "mstsc /admin" (used to be /console) and try to run jstack again. Definitely check to make sure the TMP directory is set properly if this doesn't fix the problem.

其次,jstack(或其他实用程序,如 jconsole)不会连接到本地进程,除非它在同一会话中运行。如果该服务以特定用户身份运行,您可以通过登录到同一会话进行连接。如果您使用的是远程桌面,则可以使用“mstsc /admin”(以前是 /console)进行连接,然后再次尝试运行 jstack。如果这不能解决问题,请务必检查以确保 TMP 目录设置正确。

If the service is running as LocalSystem, the above procedure probably will not help much. I don't know if there is a way to log into the same session as LocalSystem.

如果服务作为 LocalSystem 运行,上述过程可能不会有太大帮助。我不知道是否有办法登录到与 LocalSystem 相同的会话。

Some other alternatives may be to set the process up for remote monitoring and use jvisualvm (from the server itself or another machine) to connect over a port and do a thread dump.

其他一些替代方法可能是将进程设置为远程监控并使用 jvisualvm(来自服务器本身或另一台机器)通过端口连接并执行线程转储。

回答by Dr. Nichols

This is an error message from the underlying O/S. There's not much you can do in your code to deal with this other than catch the exception which is thrown. Boo to Windows for being so limited.

这是来自底层操作系统的错误消息。除了捕获抛出的异常之外,您在代码中无能为力来处理这个问题。对 Windows 如此有限的嘘声。

http://technet.microsoft.com/en-us/library/cc978735.aspx

http://technet.microsoft.com/en-us/library/cc978735.aspx

回答by Alex

psexec -s jstack PID >> c:\jstack.logperfectly works on the same machine. For the first time it took some time but again I executed with the redirect to file option, it completed with in few seconds.

psexec -s jstack PID >> c:\jstack.log在同一台机器上完美运行。第一次花了一些时间,但我再次使用重定向到文件选项执行,它在几秒钟内完成。