Task #557 (closed)
Opened 17 years ago
Closed 17 years ago
EventHandler.setEventContext is causing a flush()
Reported by: | jburel | Owned by: | jamoore |
---|---|---|---|
Priority: | blocker | Milestone: | 3.0-Beta1 |
Component: | Services | Version: | 3.0-Beta1 |
Keywords: | REVIEW | Cc: | |
Resources: | n.a. | Referenced By: | n.a. |
References: | n.a. | Remaining Time: | n.a. |
Sprint: | n.a. |
Description (last modified by jmoore)
I start the Rendering Service
I can view the image but as soon as I modified the rendering settings e.g. noiseReduction the following error is returned:
Caused by: ome.conditions.ApiUsageException: The security system is not ready. Cannot execute: managedDetails at ome.security.basic.BasicSecuritySystem.checkReady(BasicSecuritySystem.java:1328) at ome.security.basic.BasicSecuritySystem.checkManagedDetails(BasicSecuritySystem.java:469) at ome.security.basic.OmeroInterceptor.resetDetails(OmeroInterceptor.java:280) at ome.security.basic.OmeroInterceptor.onFlushDirty(OmeroInterceptor.java:165) at org.hibernate.event.def.DefaultFlushEntityEventListener.invokeInterceptor(DefaultFlushEntityEventListener.java:324) at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:301) at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:241) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:121) at ome.security.basic.FlushEntityEventListener.onFlushEntity(FlushEntityEventListener.java:77) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:196) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:35) C at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) at ome.services.query.Query.doInHibernate(Query.java:266) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:362) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:328) at ome.logic.QueryImpl.execute(QueryImpl.java:168) at ome.logic.QueryImpl.findAllByQuery(QueryImpl.java:391) at ome.security.basic.BasicSecuritySystem.clearAndCheckPrincipal(BasicSecuritySystem.java:1067) B at ome.security.basic.BasicSecuritySystem.setEventContext(BasicSecuritySystem.java:1014) at ome.security.basic.EventHandler.invoke(EventHandler.java:141) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) A at ome.tools.hibernate.SessionHandler.doStateful(SessionHandler.java:201) at ome.tools.hibernate.SessionHandler.invoke(SessionHandler.java:187) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) ... at $Proxy10.renderAsPackedInt(Unknown Source)
Change History (6)
comment:1 Changed 17 years ago by jmoore
- Description modified (diff)
- Summary changed from RenderingService to EventHandler.setEventContext is causing a flush()
comment:2 Changed 17 years ago by jmoore
Solutions:
- Get rid of the no flushing requirement on RenderingBean
- This requires storing the state in non-session-bound entities or having some other way of rolling back changes if the user changes his/her mind, e.g. on creation copying RenderingDef A to B, using B and copying B back on to A when user clicks save()
- Stop using the Spring librarires which force FlushMode.AUTO
- Doable, but they probably have a good reason for this.
- Make another workaround for Spring's flush code which sets flushMode to MANUAL.
- Give the security system its own session to prevent these problems.
comment:3 Changed 17 years ago by jmoore
I should have mentioned for the solutions, that the issue with Spring is that on encountering a FlushMode < COMMIT, it automatically sets it to AUTO ... for whatever reason. A further solution may then be:
- Trick Spring into leaving our FlushMode alone by setting it first to COMMIT (since in an application server you can't call commit anyway), and then later by downgrading it to MANUAL.
- The main problem with this is that it is dependent on Spring internals and can only be a temporary fix.
comment:4 Changed 17 years ago by jmoore
r1136 contains a failing test in bioformats-omero
comment:5 Changed 17 years ago by jmoore
- Keywords REVIEW added
r1137 provides a workaround. Will need to review the entire flush handling in Omero. (This is a bit ridiculous)
comment:6 Changed 17 years ago by jmoore
- Resolution set to fixed
- Status changed from new to closed
SessionHandler should have marked the session FlushMode.MANUAL at (A) so that when EventHandler tries to reset the context at (B) that no flush occurs like at (C).
See #427 and #428