JBoss EAP fatal StackOverflowError occurs during session passivation or replication
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 4.3
- 5.x
Issue
- We see an exception like the following when the session is replicated or passivated:
2010-02-15 10:12:44,930 FATAL [org.jboss.serial.persister.RegularObjectPersister] error
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor6250.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
at java.util.HashMap.writeObject(HashMap.java:1038)
at sun.reflect.GeneratedMethodAccessor6250.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
.. ..
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
Caused by: java.lang.StackOverflowError
at java.lang.reflect.InvocationTargetException.<init>(InvocationTargetException.java:54)
at sun.reflect.GeneratedMethodAccessor6247.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithMethod(RegularObjectPersister.java:120)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:86)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
at org.jboss.serial.persister.RegularObjectPersister.writeSlotWithFields(RegularObjectPersister.java:182)
at org.jboss.serial.persister.RegularObjectPersister.defaultWrite(RegularObjectPersister.java:90)
at org.jboss.serial.persister.RegularObjectPersister.writeData(RegularObjectPersister.java:62)
at org.jboss.serial.objectmetamodel.ObjectDescriptorFactory.describeObject(ObjectDescriptorFactory.java:276)
at org.jboss.serial.objectmetamodel.DataContainer$DataContainerDirectOutput.writeObject(DataContainer.java:206)
at org.jboss.serial.persister.ObjectOutputStreamProxy.writeObjectOverride(ObjectOutputStreamProxy.java:60)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:298)
at java.util.HashMap.writeObject(HashMap.java:1038)
Resolution
Any one of these are potential solutions
- Implement your own customized serialization protocol. This will entail extending
"java.io.Externalizable"instead of"java.io.Serializable". The"writeExternal"and"readExternal"methods will have to be correctly implemented so that all fields of the class and its superclasses are stored correctly. In addition, all classes to be serialized must have a no-argument constructor. - Re-engineer the object model to eliminate the deep nested object graphs in the session.
- Increase the thread stack size
"Xss"jvm parameter. This has the knock on effect of limiting the amount of threads that can be created
Root Cause
- Deeply nested object graph stored in the session resulting in a
"java.lang.StackOverflowError"exception during serialization for session passivation or replication.
Diagnostic Steps
Open a This content is not included.new support ticket and provide the following:
- boot.log ( this will provide more details about the underlying OS as well as the JVM startup parameters)
- UML object diagrams which can help pinpoint places in the model that could be optimized.
You can also turn on debugging for "org.jboss.serial.persister" to get more information
Components
Category
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.