Receiving 'OutOfMemory: Java heap space' due to JBoss Serialization attempting to allocate a huge StringBuffer
Issue
- Receiving 'OutOfMemory: Java heap space' due to JBoss Serialization attempting to allocate a huge StringBuffer. Sample stack trace:
2013-07-12 17:01:23,898 DEBUG [org.jboss.serial.util.StringUtil] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) Reading string with utfSize=90363601776499 isLong=true
2013-07-12 17:01:23,898 DEBUG [org.jboss.serial.util.StringUtil] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) readString::pulling data to Buffer at pos 0 size= 0
2013-07-12 17:01:23,898 DEBUG [org.jboss.serial.util.StringUtil] (ContainerBackgroundProcessor[StandardEngine[jboss.web]]) readString::pulling data to Buffer at pos 1024 size= 1024
2013-07-12 08:33:44,718 WARN [org.jboss.seam.Component] (ajp-127.0.0.1-8009-73) Exception calling component @Destroy method: org.example.DefaultClass
javax.ejb.EJBException: java.lang.RuntimeException: java.io.IOException
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
[...]
Caused by: java.lang.OutOfMemoryError: Java heap space
at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:45)
at java.lang.StringBuffer.<init>(StringBuffer.java:91)
at org.jboss.serial.util.StringUtil.readString(StringUtil.java:295)
at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectInput.readUTF(DataContainer.java:757)
at org.jboss.serial.persister.ObjectInputStreamProxy.readUTF(ObjectInputStreamProxy.java:196)
at org.jboss.serial.objectmetamodel.FieldsContainer.readField(FieldsContainer.java:147)
at org.jboss.serial.objectmetamodel.FieldsContainer.readMyself(FieldsContainer.java:218)
at org.jboss.serial.persister.ObjectInputStreamProxy.readFields(ObjectInputStreamProxy.java:224)
at java.io.File.readObject(File.java:1937)
at sun.reflect.GeneratedMethodAccessor3089.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[...]
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 5.1.0 or earlier
- 1.6 JDK+
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
