[mayaa-user:917] Mayaa内部でbeanutilsに起因するメモリリークが発生している模様です

Susumu ISHIGAMI [E-MAIL ADDRESS DELETED]
2011年 2月 2日 (水) 12:39:14 JST


お世話になっております。
石上です。

Mayaaを使用したプログラムで、特定の条件でOutOfMemoryErrorが発生することを確認しましたので報告致します。

そのプログラムでは、クラスローダを独自カスタマイズし、(簡単に例えますと、S2ContainerのHotDeployのような仕組みで)
実行時に動的にクラスをロードする仕組みを備えているのですが、
これを多用すると、Mayaaを使っているページで以下のエラーが発生します。

java.lang.OutOfMemoryError: Java heap space
	org.apache.xerces.dom.DeferredDocumentImpl.createChunk(Unknown Source)
	org.apache.xerces.dom.DeferredDocumentImpl.ensureCapacity(Unknown Source)
	org.apache.xerces.dom.DeferredDocumentImpl.createNode(Unknown Source)
	org.apache.xerces.dom.DeferredDocumentImpl.createDeferredDocument(Unknown
Source)
	org.apache.xerces.parsers.AbstractDOMParser.startDocument(Unknown Source)
	org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source)
	org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source)
	org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source)
	org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
	org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
	javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:98)
  〜固有名称が記載されているので省略します〜
	javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

このエラーはテンプレートにJSPを使っているページのみにアクセスしている限りは発生しませんでした。

原因はこれではないかと思います。
http://commons.apache.org/beanutils/v1.8.3/RELEASE-NOTES.txt
> Memory Leak
> ===========
> A memory leak was found in BeanUtils 1.7.0 (see BEANUTILS-291) which was fixed
> in BeanUtils 1.8.0 for JDK 1.5+.

参考
http://docs.redhat.com/docs/ja-JP/JBoss_Enterprise_Application_Platform/4.3/html/Release_Notes_CP04/Issues-fixed-in-this-release.html
> beanutils がバージョン 1.8.0 にアップグレードされ、WeakHashMap に関する循環参照が原因となっていたメモリーリークを修正する重要な改良が加えられました。

私のところで、試しにbeanutillsを最新の1.8.3に変えてみたところ、上記エラーが発生しなくなりました。

試していませんが、もしかすると、Seasar2のHotDeployを使用した開発環境でも再現するかもしれません。
以上、報告までに。

また、バイナリ互換性はあるとのことですが、
commons-beanutils-core-1.7.0.jarをcommons-beanutils-core-1.8.3.jar
に差し替えても問題ないか、懸念点などありましたらご回答お願い致します。
もし差し支えなければ、次回リリース時には、公式サイトにて配布される、blank war等にバンドルされる
ライブラリの更新をよろしくお願い致します。

石上 晋 ([E-MAIL ADDRESS DELETED]


mayaa-user メーリングリストの案内