写了一个web程序,可以根据输入的内容抓取网口信息以及串口信息,分别使用了:
Jpcap.dll,rxtxSerial.dll
单独开一个测试时正常,但是同时开两个抓取,tomcat就会挂掉,然后生成一个:
hs_err_pidXXXX.log文件
于是百度了一下,感觉是jvm内存的问题,就调整了一下:
-Xms1024m -Xmx1024m -Xmn600m -XX:PermSize=653m -XX:MaxPermSize=653m -XX:ParallelGCThreads=4
调试过程中发现-XX:PermSize过小服务器就会死机,不知道是什么原因,哪位大神如果知道希望给我解答一下.
服务器比较老,是win2003,4G的内存,发现无法调大了,但是错误依然存在,我截取了部分我觉得有用的错误代码:
GC Heap History (8 events):
Event: 4.269 GC heap before
{Heap before GC invocations=0 (full 0):
def new generation total 552960K, used 491520K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 100% used [0x02b60000, 0x20b60000, 0x20b60000)
from space 61440K, 0% used [0x20b60000, 0x20b60000, 0x24760000)
to space 61440K, 0% used [0x24760000, 0x24760000, 0x28360000)
tenured generation total 434176K, used 0K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 0% used [0x28360000, 0x28360000, 0x28360200, 0x42b60000)
compacting perm gen total 667648K, used 8941K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 1% used [0x42b60000, 0x4341b4a0, 0x4341b600, 0x6b760000)
No shared spaces configured.
Event: 4.429 GC heap after
Heap after GC invocations=1 (full 0):
def new generation total 552960K, used 61440K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 0% used [0x02b60000, 0x02b60000, 0x20b60000)
from space 61440K, 100% used [0x24760000, 0x28360000, 0x28360000)
to space 61440K, 0% used [0x20b60000, 0x20b60000, 0x24760000)
tenured generation total 434176K, used 13941K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 3% used [0x28360000, 0x290fd510, 0x290fd600, 0x42b60000)
compacting perm gen total 667648K, used 8941K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 1% used [0x42b60000, 0x4341b4a0, 0x4341b600, 0x6b760000)
No shared spaces configured.
}
Event: 7.331 GC heap before
{Heap before GC invocations=1 (full 0):
def new generation total 552960K, used 552960K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 100% used [0x02b60000, 0x20b60000, 0x20b60000)
from space 61440K, 100% used [0x24760000, 0x28360000, 0x28360000)
to space 61440K, 0% used [0x20b60000, 0x20b60000, 0x24760000)
tenured generation total 434176K, used 13941K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 3% used [0x28360000, 0x290fd510, 0x290fd600, 0x42b60000)
compacting perm gen total 667648K, used 14009K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 2% used [0x42b60000, 0x4390e4e0, 0x4390e600, 0x6b760000)
No shared spaces configured.
Event: 7.469 GC heap after
Heap after GC invocations=2 (full 0):
def new generation total 552960K, used 60265K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 0% used [0x02b60000, 0x02b60000, 0x20b60000)
from space 61440K, 98% used [0x20b60000, 0x2463a6f0, 0x24760000)
to space 61440K, 0% used [0x24760000, 0x24760000, 0x28360000)
tenured generation total 434176K, used 34836K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 8% used [0x28360000, 0x2a5652c0, 0x2a565400, 0x42b60000)
compacting perm gen total 667648K, used 14009K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 2% used [0x42b60000, 0x4390e4e0, 0x4390e600, 0x6b760000)
No shared spaces configured.
}
Event: 36.600 GC heap before
{Heap before GC invocations=2 (full 0):
def new generation total 552960K, used 551785K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 100% used [0x02b60000, 0x20b60000, 0x20b60000)
from space 61440K, 98% used [0x20b60000, 0x2463a6f0, 0x24760000)
to space 61440K, 0% used [0x24760000, 0x24760000, 0x28360000)
tenured generation total 434176K, used 34836K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 8% used [0x28360000, 0x2a5652c0, 0x2a565400, 0x42b60000)
compacting perm gen total 667648K, used 24620K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 3% used [0x42b60000, 0x4436b0b0, 0x4436b200, 0x6b760000)
No shared spaces configured.
Event: 36.714 GC heap after
Heap after GC invocations=3 (full 0):
def new generation total 552960K, used 30082K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 0% used [0x02b60000, 0x02b60000, 0x20b60000)
from space 61440K, 48% used [0x24760000, 0x264c08f0, 0x28360000)
to space 61440K, 0% used [0x20b60000, 0x20b60000, 0x24760000)
tenured generation total 434176K, used 41289K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 9% used [0x28360000, 0x2abb2550, 0x2abb2600, 0x42b60000)
compacting perm gen total 667648K, used 24620K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 3% used [0x42b60000, 0x4436b0b0, 0x4436b200, 0x6b760000)
No shared spaces configured.
}
Event: 86.711 GC heap before
{Heap before GC invocations=3 (full 0):
def new generation total 552960K, used 521602K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 100% used [0x02b60000, 0x20b60000, 0x20b60000)
from space 61440K, 48% used [0x24760000, 0x264c08f0, 0x28360000)
to space 61440K, 0% used [0x20b60000, 0x20b60000, 0x24760000)
tenured generation total 434176K, used 41289K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 9% used [0x28360000, 0x2abb2550, 0x2abb2600, 0x42b60000)
compacting perm gen total 667648K, used 25095K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 3% used [0x42b60000, 0x443e1e08, 0x443e2000, 0x6b760000)
No shared spaces configured.
Event: 86.754 GC heap after
Heap after GC invocations=4 (full 0):
def new generation total 552960K, used 14048K [0x02b60000, 0x28360000, 0x28360000)
eden space 491520K, 0% used [0x02b60000, 0x02b60000, 0x20b60000)
from space 61440K, 22% used [0x20b60000, 0x21918378, 0x24760000)
to space 61440K, 0% used [0x24760000, 0x24760000, 0x28360000)
tenured generation total 434176K, used 41289K [0x28360000, 0x42b60000, 0x42b60000)
the space 434176K, 9% used [0x28360000, 0x2abb2550, 0x2abb2600, 0x42b60000)
compacting perm gen total 667648K, used 25095K [0x42b60000, 0x6b760000, 0x6b760000)
the space 667648K, 3% used [0x42b60000, 0x443e1e08, 0x443e2000, 0x6b760000)
No shared spaces configured.
}
感觉Xmn还是小了,于是用自己的8G内存的电脑也试了一下:
-Xms2048m -Xmx2048m -Xmn1500m -XX:PermSize=800m -XX:MaxPermSize=800m -XX:ParallelGCThreads=4
错误还在,
eden space 1152000K, 100% used
感觉Xmn依然小了
第一次遇见这种问题,感觉既然单条任务可以,两条任务我把内存已经调大好几倍应该不会有问题了,但是问题依然存在,应该不单单是调整JVM的问题了,只能上网求助了