oracle 异常退出,Oracle JVM加载类时出现的一个异常退出问题

JDK-7129299 : JVM crash issue related to jar files

This may be another cases where a zip/JAR file is overwritten while it is being used. In JDK7 the property can be used to disable the mmapping of the central directory to avoid this when there is stepping on toes.

Java SE 6 Advanced and Java SE 6 Support (formerly known as Java SE for Business 6) Release Notes

Changes in 6u21-rev-b09 Disabling mmap Usage (on Solaris or Linux) This release includes a new system property,which allows the user to disable the mmap usage in Sun's implementation (on Solaris and Linux platforms). Solaris or Linux applications that use may experience a SIGBUS VM crash if the application accidentally overwrites any zip or jar files that are still being used by the same Java runtime. 在Solaris和Linux平台下,Sun(Oracle)发布的JDK中 类的实现里,有代码使用了操作系统提供的mmap特性。在某些特殊的场景(比如JVM已加载的jar或者zip被外部修改后,JVM再次读取该文件的内容)下,该特性会导致JVM收到SIGBUS,进而导致JVM异常退出。 Although this is a programming error of the offending application,this system property provides a solution to avoid the VM crash. With the property set to true (,or simply ) the Sun JDK/JRE runtime disables the mmap usage and the VM crash that might otherwise occur by overwriting the jar or zip file can be avoided. 类似的现象并非由JVM自身的Bug导致,但Oracle JVM开发团队仍然提供了规避方案(从其它文章看,JVM的开发团队其实并不是非常情愿)。启动应用时,为JVM传入参数 或者 ,可以避免jar或者zip文件操作时引发的JVM异常退出现象。

[Bug 190481] New: Consider using -Dsun.zip.disableMemoryMapping=true

See Java bugs #4425695,#6929479. As of JDK 6u21 or 7,a system property can be set to prevent JVM crashes when overwriting an open JAR. (Only applies to Unix,since on Windows you could not open the JAR for writing to begin with.) This may be helpful to avoid crashes caused by buggy Ant scripts,etc. But needs to be checked to see if performance degrades as a result.

JVM crashes due to corrupted JAR file

The reason why JAR files cannot be modified underneath the JVM is because the JVM caches each JAR file's central directory structure (using mmap) for performance reasons. The central directory is the part of the JAR file that describes its contents - i.e. entry locations,sizes and so on. Caching it in memory means that the JVM does not have to read it from the disk every time an entry in that JAR file needs to be accessed. 默认情况下,JVM从jar加载类时,会使用平台的mmap特性将jar文件的结构信息缓存到内存中,以此方法避免对jar文件结构进行反复读取,借以提高工作效率。 If the JAR file is modified after this region has been cached,then the JVM's version of the central directory will no longer be an accurate description of the JAR file as it exists on disk and the end result is a SIGBUS or SIGSEGV when the JVM attempts to load an entry from the modified JAR file (usually during class loading). Note: This has been a well known limitation of the HotSpot JVM for a long time but Oracle did recently introduce an option to work around the issue. From 1.6.0_23 onwards,the following option can be added to the command line to completely disable memory mapping for ZIP/JAR files: Enabling this option will impact performance because the VM will have to conduct some additional disk IO every time it reads an entry from a JAR file (to interrogate the central directory structure). 启用本选项后,JVM加载类时需要花费时间直接从硬盘上的jar文件中加载所需的数据;相比于启用该选项前,引发了额外的硬盘IO操作,因而对JVM、应用的性能产生一些影响。 As a result,you should verify whether any jar files were modified some time prior to the crashes starting,while the JVM was still running. 遇到类似前述的异常退出现象后,开发人员需要确认在JVM正常启动后、到异常退出前,是否发生过jar文件被修改的现象。

weblogic jvm -Dsun.zip.disableMemoryMapping=true

There are three possible scenarios here: 三种场景 1. While a class is in use it is dynamically reloaded from a jar file. 类已加载,但重新被ClassLoader加载时。 2. While a jar file is being accessed by the class loader,the jar file is being modified. 类加载器正在访问某jar文件时,该jar被外部修改了。 3. A Jarfile which was bigger than 4GB was accessed (applies to Java 6 and earlier only). 对于1.6及以前版本的JDK,待访问的jar文件长度超出4GB。 这篇文章附有完全的异常信息,可以和官方提供的异常信息对照着分析。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值