在通过cron启动JVM时,我遇到了一条奇怪的消息:“没有控制台,将分叉以获得足够的内存”。Google在搜索字符串时只返回少数几个结果,所以我想在这里询问是否有人知道它的更多信息。
当我从命令行启动JVM或JVM在启动时通过init脚本启动时,不会出现此消息。
在所有情况下,都会调用相同的init脚本来启动它,JVM将被传递相同的参数:
java -server -Xmx4096m -XX:MaxPermSize=256M -Djava.awt.headless=true -Djava.security.auth.login.config=/usr/local/aem/
author-4502/crx-quickstart/conf/ldap_login.conf -Dcom.sun.management.jmxremote.port=9502 -Dcom.sun.management.jmxremote.
authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar cq5-author-p4502.jar -use-control-port -p 4502 -gui -no
browser -verbose -r japan,qa更具体地说,JVM消息是在这个上下文中输出的:
...
Low-memory action set to fork
Using 64bit VM settings, min.heap=1024MB, min permgen=256MB, default fork arguments=[-Xmx1024m, -XX:MaxPermSize=256m]
The JVM reports a heap size of 3641 MB, meets our expectation of 1024 MB +/- 20
The JVM MBean:PS Perm Gen reports a maximum size of 256 MB, meets our expectation of 256 MB +/- 20
No console, will fork to get enough memory
...似乎存在一些默认行为,JVM将在其中分叉另一个实例,以避免内存不足的情况。所以我想知道为什么从cron作业调用JVM会触发这种行为?为什么不将控制台解释为“低内存”,即使JVM已经确认它有足够的堆和permgen内存?
我用的是RHEL 6.4。
Java包名称: jdk-1.7.0_55-fcs.x86_64
java -version输出:
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)发布于 2015-02-24 16:20:06
该消息来自CQ应用程序,而不是JVM。据我所知,在某些情况下,CQ将为系统的不同部分启动单独的JVM。CQ有一些命令行选项来控制这种行为:
-debug <port>
Enable Java Debugging on port number; forces forking
-nofork
Do not fork the JVM, even if not running on a console
-fork
Force forking the JVM if running on a console, using recommended
default memory settings for the forked JVM.
-forkargs <args> [<args> ...]
Additional arguments for the forked JVM, defaults to '-Xmx1024m
-XX:MaxPermSize=256m '. Use -- to specify values starting with -,
example: '-forkargs -- -server'有关启动和停止CQ的详细信息,请参见此页。搜索“叉”可以看到(很少)提到这种行为。
https://serverfault.com/questions/670659
复制相似问题