cancel
Showing results for 
Search instead for 
Did you mean: 

LazyInitializationException when retrieving Workflows/tasks

vycitalr
Champ in-the-making
Champ in-the-making
Hello,
I am having problems getting workflows/tasks. My system started to throw LazyIntializationExceptions as to getting TaskInstance's variableInstance. This seem to came into existence when there are more (eg. 50-100) workflows/tasks in system.  In other words, I get some TaskInstances via JBPMEngine.queryTasks(), and while fetching their VariableInstances I get the LazyInicializationException for some of the tasks while for others it is ok. And this happens in one transation. If I catch the errror and examine the sesssion, it says it is ok - "connected" and "open".   It seems to happen again and again for the same tasks, so they might be somewhat corrupted but could not see how.

The exact stacktrace is here

18:04:54,551 INFO  [STDOUT] 18:04:54,551 DEBUG [alfresco.repo.workflow] Detached (rollback) JBPM Context from transaction 56859328-04bc-11dd-bdef-c75961e062bb
18:04:54,552 INFO  [STDOUT] 18:04:54,552 ERROR [ui.common.Utils] Failed to get all active tasks: org.springframework.orm.hibernate3.HibernateSystemException: failed to lazily initialize a collection of role: or
g.jbpm.taskmgmt.exe.TaskInstance.variableInstances, no session or session was closed; nested exception is org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.jbpm.ta
skmgmt.exe.TaskInstance.variableInstances, no session or session was closed
org.springframework.orm.hibernate3.HibernateSystemException: failed to lazily initialize a collection of role: org.jbpm.taskmgmt.exe.TaskInstance.variableInstances, no session or session was closed; nested exce
ption is org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.jbpm.taskmgmt.exe.TaskInstance.variableInstances, no session or session was closed
Caused by:
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: org.jbpm.taskmgmt.exe.TaskInstance.variableInstances, no session or session was closed
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:358)
        at org.hibernate.collection.AbstractPersistentCollection.throwLazyInitializationExceptionIfNotConnected(AbstractPersistentCollection.java:350)
        at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:343)
        at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
        at org.hibernate.collection.PersistentMap.entrySet(PersistentMap.java:242)
        at org.jbpm.context.exe.VariableContainer.getVariablesLocally(VariableContainer.java:103)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine.getTaskProperties(JBPMEngine.java:1932)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine.createWorkflowTask(JBPMEngine.java:2800)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine$24.doInJbpm(JBPMEngine.java:1282)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine$24.doInJbpm(JBPMEngine.java:1259)
        at org.springmodules.workflow.jbpm31.JbpmTemplate$1.doInHibernate(JbpmTemplate.java:87)
        at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:367)
        at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:333)
        at org.springmodules.workflow.jbpm31.JbpmTemplate.execute(JbpmTemplate.java:80)
        at org.alfresco.repo.workflow.jbpm.JBPMEngine.queryTasks(JBPMEngine.java:1257)
        at org.alfresco.repo.workflow.WorkflowServiceImpl.queryTasks(WorkflowServiceImpl.java:433)
        at sun.reflect.GeneratedMethodAccessor674.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
        at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:40)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.java:241)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
        at $Proxy124.queryTasks(Unknown Source)
        at com.cleverbee.web.bean.workflow.WorkflowBean.getAllActiveTasks(WorkflowBean.java:117)
        at com.cleverbee.web.bean.workflow.PrintableTaskBean.getTasks(PrintableTaskBean.java:128)
        at com.cleverbee.web.bean.workflow.AFilterredTaskBean.getInit(AFilterredTaskBean.java:83)
        at sun.reflect.GeneratedMethodAccessor673.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:457)
        at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:85)
        at org.apache.myfaces.el.ELParserHelper$MyPropertySuffix.evaluate(ELParserHelper.java:535)
        at org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
        at org.apache.myfaces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:386)
        at javax.faces.component.UIOutput.getValue(UIOutput.java:80)
        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getStringValue(RendererUtils.java:223)
        at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.renderOutput(HtmlTextRendererBase.java:69)
        at org.apache.myfaces.shared_impl.renderkit.html.HtmlTextRendererBase.encodeEnd(HtmlTextRendererBase.java:57)
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:419)
        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChildren(RendererUtils.java:400)
        at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:417)

I just found these similliar issues that might be related, but it didn't help.

http://issues.alfresco.com/browse/WCM-1079?page=com.atlassian.jira.plugin.system.issuetabpanels:comm...
http://217.174.252.22/viewtopic.php?p=29820&sid=e683ffb5254f6338ef749309b296188c

I experinced this problem with PostgreSQL as well as with Oracle. I am using version 2.2.0 schema 105 on Linux Debian.

Thank you for any help.
9 REPLIES 9

janv
Employee
Employee
Can you please post your startup log showing full build # / schema # ?

It sounds as if you might be using an old nightly/HEAD development build (just before the versioning was switched from 2.2-Dev to 2.9-Dev) rather than a release download of Community or Enterprise ?

If so, can you please see if your problem is repeatable on a test system using either 2.1-Community and/or the latest 2.9B-Community Labs.

Thanks,
Jan

chrisb
Champ in-the-making
Champ in-the-making
We have just come across exactly this issue when trying to create over 100 workflow tasks as a result of a data import operation. We are using the Enterprise v2.1.1 (193) schema 77 running on RHEL 5 using a PostgreSQL database.

I will file a JIRA issue for this.

Is there any way to access information on the current size of the workflow.pooledTasks list outside of the Freemarker API? Our data import is initiated from the JS component of a webscript, so ideally we would like to be able to access information on the current size of the workflow task pool before initiating the data import.

Thanks,

Chris

chrisb
Champ in-the-making
Champ in-the-making
JIRA issue raised: http://issues.alfresco.com/browse/AR-2296

Thanks, Chris

vycitalr
Champ in-the-making
Champ in-the-making
For janv:
Yes, you are right, I am using sort of 2.2-dev based HEAD/night build. In fact it is basically revision 1038 from HEAD, so my version.properties are

version.major=2
version.minor=2
version.revision=0
version.label=dev
version.edition=Community Network
version.schema=105

But later I updated to a little later revsion, but did not update the version.properties somehow, so its difficult to say the exact scehma version. Now inspecting it back from SVN, I think it is schema 107.

I will try to restest on some release version (2.1 or so). Will inform when I have results.

varsenault
Champ in-the-making
Champ in-the-making
Hi guys,

Continuing here the discussion we started in the workflow forum : http://forums.alfresco.com/viewtopic.php?f=4&t=12227

We didn't install the patch because, according to what I could read on JIRA, it didn't fix the problem of those with similar symptoms.

For your information, we have a 64 bit X86 FC7 machine with Alfresco 2.1, JDK 1.5.0_12 and MySQL 5.0.37.

Here are our startup hearders :

Alfresco JVM - v1.5.0_08-b03; maximum heap size 992.688MB
Alfresco started (Community Network): Current version 2.1.0 (484) schema 64 - Installed version 2.1.0 (484) schema 64

We get this LazyInitializationException all the time. Now, we have to impose a very strict and costly operational discipline to minimize the load on the server.

Should we allocate more RAM? Is there a new community edition release that is fixing this coming up soon (I know 2.9 doesn't)? Are other solution patterns emerging at this point? Is it fixed in the enterprise edition?

This is a very irritating issue on a product that is otherwise pretty good. Help would be much much appreciated.

Thanks.

janv
Employee
Employee
It would be useful to have a repeatable test case, including test data etc. The other person who applied the patch was using a dev build so their results might be inconclusive. I would recommend backing up your system and applying the AMP patch (AR-2212) to see if this resolves your specific issue. That particular fix has been integrated into the latest Enterprise releases and now also merged into 2.9 & HEAD, so will be included in the next Community release.

Regards,
Jan

varsenault
Champ in-the-making
Champ in-the-making
Well,

I don't know how to generate a repeatable test case because the problem seems to be volume-based.Our Alfresco repository is around 60GB and there are around 500 instances of the same workflow definition running at the same time. On one of the transitions, there is an ActionHandler that is taking around 3 minutes to run, and it seems that the amount of people going through that transition will condition the occurence of the bug.

We tried to create a cloned instance of the master Alfresco system on which we are experiencing the problem, but we're having trouble just doing that. We posted our misfortune on another thread : http://forums.alfresco.com/viewtopic.php?f=13&t=12432&p=41537

When will the next community version be released? We'll continue on with trying the patch if we can get a clone of the problematic system.

You guys take care! Smiley Wink

varsenault
Champ in-the-making
Champ in-the-making
We have successfully built a clone instance. We will test the patch later this week and we will let you know.

Thanks,

Vincent

jimcornmell
Champ in-the-making
Champ in-the-making
Has anyone fixed this?  I've go the same issue on the cummunity release.