cancel
Showing results for 
Search instead for 
Did you mean: 

StackoverflowError while deserializing process variable

swamy2156
Champ on-the-rise
Champ on-the-rise
This issue coming now in our production systems. As per business need, we serialize xml documents as process variable. For small document, everything fine. But for document having 20K lines of content creating problem while deserializing the process variable(e.g., delegateTask.getVariables() ).
I am surprised there is no problem while serializing it in production server.(But, I am facing serialize problem when I initiate workflow from eclipse while storing it in Variable table). While debug I came to know that SerializableType.deserialize() -> Object deserializedObject = ois.readObject(); causing StackOverflowError.
Because of this, we are not able to do any operations on that task in production. Is there any alternate/fix to get rid of StackOverflowException while se/deserializing large process variables??

/* SerializableType.deserialize() method */
  public Object deserialize(byte[] bytes, ValueFields valueFields) {
    ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
    try {
      ObjectInputStream ois = createObjectInputStream(bais);
      Object deserializedObject = ois.readObject();   //***throwing StaskOverflowError***

      return deserializedObject;
    } catch (Exception e) {
      throw new ActivitiException("Couldn't deserialize object in variable '"+valueFields.getName()+"'", e);
    } finally {
      IoUtil.closeSilently(bais);
    }
  }


** attached my realtime xml document for which I am facing this issue along with this ticket.
Thanks,
Swamy.
5 REPLIES 5

swamy2156
Champ on-the-rise
Champ on-the-rise
This is the Error stacktrace that I am seeing in logs….
Caused by: org.activiti.engine.ActivitiException: Error while evaluating expression: #{workflowTaskListner.notify(task)}
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:57)
at org.activiti.engine.impl.bpmn.listener.ExpressionTaskListener.notify(ExpressionTaskListener.java:33)
at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:723)
… 60 more
Caused by: org.activiti.engine.impl.javax.el.ELException: java.lang.StackOverflowError
at org.activiti.engine.impl.javax.el.BeanELResolver.invoke(BeanELResolver.java:487)
at org.activiti.engine.impl.javax.el.CompositeELResolver.invoke(CompositeELResolver.java:397)
at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:91)
at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75)
at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:48)
… 65 more
Caused by: java.lang.StackOverflowError
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2310)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2323)
at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2818)
at java.io.ObjectInputStream.readHandle(ObjectInputStream.java:1452)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1511)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
—————–
n last 4 lines repeated till end of exception.

swamy2156
Champ on-the-rise
Champ on-the-rise
BTW, I am using Activiti v5.17 & Oracle v11G & Jdk v1.7 and exceptions in log I am seeing are as follows….

Caused by: org.activiti.engine.ActivitiException: Error while evaluating expression: #{workflowTaskListner.notify(task)}
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:57)
at org.activiti.engine.impl.bpmn.listener.ExpressionTaskListener.notify(ExpressionTaskListener.java:33)
at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:723)
… 60 more
Caused by: org.activiti.engine.impl.javax.el.ELException: java.lang.StackOverflowError
at org.activiti.engine.impl.javax.el.BeanELResolver.invoke(BeanELResolver.java:487)
at org.activiti.engine.impl.javax.el.CompositeELResolver.invoke(CompositeELResolver.java:397)
at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:91)
at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75)
at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:48)
… 65 more
Caused by: java.lang.StackOverflowError
at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2310)
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2323)
at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:2818)
at java.io.ObjectInputStream.readHandle(ObjectInputStream.java:1452)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1511)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1990)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1915)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1798)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
………and last 4 lines repeated for 250 times till end of trace.

trademak
Star Contributor
Star Contributor
Hi Swamy,

How is the XML document stored as a variable? Do you store it as text/string or do you store the XML Document object?

Best regards,

swamy2156
Champ on-the-rise
Champ on-the-rise
Storing xml document as object.

trademak
Star Contributor
Star Contributor
Ok, it would be better to store an XML document as a String with the XML as text. This would prevent serialization and deserialization issues.

Best regards,