-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
4.3.0, 4.5.4
-
Severity 2 - Major
-
16
-
How to reproduce:
- Have 2 open reviews in CR project
- Call http://localhost:6060/foo/cru/rssReviewFilter?filter=allOpenReviews&project=CR
Actual result:
com.atlassian.crucible.actions.RSSReviewQueryAction and rssReviewFilter.jsp don't handle Hibernate sessions and transactions properly. New transaction is being opened every time, when JSP tries to render review.stateSetDate value.
When there's a lot of reviews matching the filter (e.g >10000), the Hibernate autoflush can take significant amount of time and generate high CPU load.
java.lang.Thread.State: RUNNABLE at org.apache.log4j.Category.getEffectiveLevel(Category.java:442) at org.apache.log4j.Category.isEnabledFor(Category.java:751) at org.jboss.logging.Log4jLogger.isEnabled(Log4jLogger.java:40) at org.jboss.logging.Logger.isTraceEnabled(Logger.java:98) at org.hibernate.internal.CoreMessageLogger_$logger.isTraceEnabled(CoreMessageLogger_$logger.java:418) at org.hibernate.event.internal.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:475) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:100) at org.hibernate.event.internal.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:90) at org.hibernate.internal.SessionImpl.fireSaveOrUpdate(SessionImpl.java:654) at org.hibernate.internal.SessionImpl.saveOrUpdate(SessionImpl.java:646) at org.hibernate.engine.spi.CascadingAction$5.cascade(CascadingAction.java:258) at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:396) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:339) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:207) at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:426) at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:366) at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:342) at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:207) at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:164) at org.hibernate.event.internal.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:165) at org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:156) at org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:89) at org.hibernate.event.internal.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:61) at org.hibernate.internal.SessionImpl.autoFlushIfRequired(SessionImpl.java:1130) at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1187) at org.hibernate.internal.QueryImpl.list(QueryImpl.java:101) at com.cenqua.crucible.hibernate.HibernateUtil.typedList(HibernateUtil.java:216) at com.cenqua.crucible.model.managers.DefaultStateChangeLogManager.getStateChanges(DefaultStateChangeLogManager.java:59) at sun.reflect.GeneratedMethodAccessor1134.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy91.getStateChanges(Unknown Source) at com.cenqua.crucible.model.Review.getStateChanges(Review.java:560) at com.cenqua.crucible.model.Review.getStateSetDate(Review.java:496) at sun.reflect.GeneratedMethodAccessor1527.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at javax.el.BeanELResolver.getValue(BeanELResolver.java:305) at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:188) at com.sun.el.parser.AstValue.getValue(AstValue.java:120) at com.sun.el.parser.AstValue.getValue(AstValue.java:167) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:224) at org.apache.jasper.runtime.PageContextImpl.evaluateExpression(PageContextImpl.java:1009) at org.apache.jsp.WEB_002dINF.jsp.crucible.rss.rssReviewFilter_jsp._jspx_meth_cru_formatDate_0(rssReviewFilter_jsp.java:177) at org.apache.jsp.WEB_002dINF.jsp.crucible.rss.rssReviewFilter_jsp._jspx_meth_c_forEach_0(rssReviewFilter_jsp.java:119) at org.apache.jsp.WEB_002dINF.jsp.crucible.rss.rssReviewFilter_jsp._jspService(rssReviewFilter_jsp.java:80) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
Expected behaviour:
Session is opened in read only mode, transaction autoflushes don't happen.