oc4j或者是java的奇怪的内存错误问题,无论如何都不给应用分配内存。
我用的环境为OC4J 10G+jdk1.4.2_10,在启动配置里面添加了分配内存的配置,加到了512M。
但是实际上从打出的GC log里面看出,根本没有分配那么多内存给应用,每次应用达到64M就抛出
outofmemory错误。
但同时在UAT上面一样的配置一样的环境,却可以正常的分配到512M的内存?
能想到的可能有影响的地方都在prod这边做成和UAT的一致并测试了。jdk,目录,ant版本,源代码当然一致,配置文件,oc4j版本等等。
下面是配置文件,prod和UAT的都一样。另外两边的主机也一样都是dell服务器。2G内存,intel至强4核CPU
echo off
SET J2EE_HOME=D:oc4jj2eehome
SET OPTIONS=-server -Xms512m -Xmx512m -XX:NewSize=512m -XX:MaxNewSize=512m -XXermSize=256m -XX:MaxPermSize=256m
SET OPTIONS=-Dapplication.context.path="META-INF/bean-context.xml"
SET OPTIONS=%OPTIONS% -Djdbc.connection.debug=true
SET OPTIONS=%OPTIONS% -Dorg.apache.commons.logging.LogFactory=org.apache.commons.logging.impl.Log4jFactory
SET OPTIONS=%OPTIONS% -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps
SET OPTIONS=%OPTIONS% -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime
SET OPTIONS=%OPTIONS% -Xloggc:/temp/Dashboard_gc.log
SET OPTIONS=%OPTIONS% -Dlog4j.configuration=file:/D:/DashboardApplication/dashboard/deploy/log4j.properties
"%JAVA_HOME%binjava" %OPTIONS% -jar %J2EE_HOME%oc4j.jar -config .configserver.xml
如下是prod的部分GC log(从log文件开始处节选的部分),可以看到一开始启动的时候,并没有分配最大内存给它。并且总会在达到64M的时候抛出错误。
Application time: 0.0401729 seconds
0.000: [GC 0.000: [DefNew: 506K->64K(576K), 0.0030251 secs] 506K->203K(1984K), 0.0030736 secs]
Total time for which application threads were stopped: 0.0032681 seconds
Application time: 0.0150489 seconds
0.018: [GC 0.018: [DefNew: 575K->18K(576K), 0.0011364 secs] 715K->244K(1984K), 0.0011693 secs]
Total time for which application threads were stopped: 0.0012119 seconds
Application time: 0.0328663 seconds
0.052: [GC 0.052: [DefNew: 524K->18K(576K), 0.0009157 secs] 750K->245K(1984K), 0.0009479 secs]
Total time for which application threads were stopped: 0.0009949 seconds
Application time: 0.0638840 seconds
0.117: [GC 0.117: [DefNew: 530K->47K(576K), 0.0017448 secs] 756K->273K(1984K), 0.0017995 secs]
Total time for which application threads were stopped: 0.0018945 seconds
Application time: 0.1353847 seconds
0.255: [GC 0.255: [DefNew: 558K->64K(576K), 0.0016452 secs] 785K->369K(1984K), 0.0016855 secs]
Total time for which application threads were stopped: 0.0017582 seconds
Application time: 0.0283784 seconds
Total time for which application threads were stopped: 0.0000550 seconds
Application time: 0.0214921 seconds
0.306: [GC 0.306: [DefNew: 575K->64K(576K), 0.0015439 secs] 881K->504K(1984K), 0.0015855 secs]
Total time for which application threads were stopped: 0.0016496 seconds
Application time: 0.0489205 seconds
0.357: [GC 0.357: [DefNew: 575K->26K(576K), 0.0011764 secs] 1016K->530K(1984K), 0.0012212 secs]
Total time for which application threads were stopped: 0.0017364 seconds
Application time: 0.2694250 seconds
这是prod oc4j控制台bat窗口上显示的东西。没看懂是指什么。网上没有搜到。
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3302]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3322]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3307]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3284]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3283]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3301]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3269]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3282]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3311]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3270]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3297]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3324]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3296]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3305]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3320]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3281]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3309]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3321]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3290]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3299]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3295]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3298]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3325]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3304]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3317]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3289]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3319]
[Unloading class sun.reflect.GeneratedSerializationConstructorAccessor3306]
[Unloading class sun.reflect.GeneratedMethodAccessor316]
这是UAT的GC log,可以看出,一开始就分配了512M内存,并且由于内存足够,所以基本没有进行多少GC回收。(完整log)
Application time: 0.3611351 seconds
Total time for which application threads were stopped: 0.0041917 seconds
Application time: 1.2638166 seconds
0.000: [Full GC 0.000: [Tenured: 0K->1476K(466048K), 0.0396829 secs] 14372K->1476K(518464K), [Perm : 6833K->6833K(16384K)], 0.0397497 secs]
[ 本帖最后由 roylone 于 2008-9-15 11:45 编辑 ]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
种种行政原因,无法更换。希望有人给出可行的建议。
改用WebLogic吧,OC4J在11g的时候就被WebLogic替代了,呵呵,开玩笑的,没碰到过你这个问题,你可以换成JRockit试试。
没搞过这个东西
你的jvm设置是多少
没人回答吗?我顶起来,问题比较棘手。