Opened 18 years ago

Closed 18 years ago

#577 closed defect (duplicate)

exception while emptying trash (experiment and raw bioassays)

Reported by: base Owned by: Nicklas Nordborg
Priority: minor Milestone: BASE 2.4
Component: core Version:
Keywords: trashcan Cc:

Description (last modified by Jari Häkkinen)

Relates to ticket:252.

Just got this error while emptying the trash.

The trash contained a mix of items (including an Experiment and its Raw BioAssays). I will try deleting from "top down" to see if I can empty the trash.

Experiment first, then raw bioassays works fine, although the 57 bioassays take some time.

I tagged it "major" because this would throw a novice user.

cheers, Bob (again!)

Experiment   
Options…   
Unexpected error
BaseException on page /base2dev/views/trashcan/index.jsp
	
Version 	BASE 2.2.2 (build #3172; schema #30)
Web server 	Apache Tomcat/5.5.20
Database Dialect 	org.hibernate.dialect.MySQLInnoDBDialect
JDBC Driver 	com.mysql.jdbc.Driver (version 5.0)
Java runtime 	Java(TM) SE Runtime Environment (1.6.0-b105), Sun Microsystems Inc.
Operating system 	Linux amd64 2.6.16.27-0.9-smp
Memory 	Total: 483.3 MB
Free: 244.0 MB
Max: 910.3 MB
Browser 	Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.11) Gecko/20070312 Firefox/1.5.0.11
Error message 	Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [net.sf.basedb.core.data.BioAssayData#205]
Stack trace 	

...at HibernateUtil.flush(HibernateUtil.java:936)
...at DbControl.commit(DbControl.java:378)
...at org.apache.jsp.views.trashcan.index_jsp.removeItems(index_jsp.java:74)
...at org.apache.jsp.views.trashcan.index_jsp._jspService(index_jsp.java:314)
...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
...at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:71)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
...at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
...at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
...at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
...at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
...at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
...at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
...at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
...at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
...at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
...at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
...at java.lang.Thread.run(Thread.java:619)

Caused by: org.hibernate.StaleObjectStateException
...at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1761)
...at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2519)
...at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2693)
...at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
...at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
...at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
...at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:144)
...at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
...at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
...at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
...at HibernateUtil.flush(HibernateUtil.java:932)
...at DbControl.commit(DbControl.java:378)
...at org.apache.jsp.views.trashcan.index_jsp.removeItems(index_jsp.java:74)
...at org.apache.jsp.views.trashcan.index_jsp._jspService(index_jsp.java:314)
...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
...at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:71)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
...at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
...at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
...at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
...at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
...at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
...at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
...at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
...at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
...at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
...at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
...at java.lang.Thread.run(Thread.java:619)

Change History (7)

comment:1 by base, 18 years ago

or I suppose it could have been a problem deleting files and their containing directory (from Micha's batch importer)

and I just got an error while deleting Bioassaysets and Transformations, but I'm rapidly losing my test data (I'm deleting it). Separately (Bioassaysets first) they delete OK. I forgot to copy the error message (it wasn't a stack trace this time) - oops.

Sorry this is a rather vague bug report - I'll do some more deleting next week I'm sure.

Bob.

comment:2 by Nicklas Nordborg, 18 years ago

Component: webcore
Milestone: BASE 2.4
Owner: changed from Johan Enell to Nicklas Nordborg

Experiment first, then raw bioassays works fine, although the 57 bioassays take some time.

What were you deleting when you got the stack trace?

I think I have seen something similar before. That was caused by an incorrect cascade=delete mapping in Hibernate. The cascade caused Hibernate to try to delete a row that we had already deleted ourselves earlier. It was possible to workaround this by deleting items in the proper order, but it is not easy to know what the proper order is.

The problem might go away when ticket #252 (Make the trashcan smarter when deleting items) has been fixed.

comment:3 by Jari Häkkinen, 18 years ago

Milestone: BASE 2.4BASE 2.3

Milestone BASE 2.4 deleted

comment:4 by Jari Häkkinen, 18 years ago

Description: modified (diff)

comment:5 by Nicklas Nordborg, 18 years ago

Priority: majorminor

comment:6 by Nicklas Nordborg, 18 years ago

Status: newassigned

comment:7 by Nicklas Nordborg, 18 years ago

Resolution: duplicate
Status: assignedclosed

I have now been able to reproduce this problem. It is triggered when a File or Directory is deleted at the same time as more than one BioAssaySet in the same branch of an analysis tree. It doesn't happen every time, since it depends on the deletion order of the File/Directory in relation to the BioAssaySet:s. This is unpredictable since the items are put in a Set before they are deleted.

The problem is caused by a call to HibernateUtil.flush() whenever a File or Directory is deleted. This call is needed since otherwise it is impossible to delete files/directories recursively. The side-effect is that the bioassay sets are also deleted recursively by Hibernate cascade, resulting in the exception when reaching the second bioassay set in the same branch.

Most likely, this problem is solved by deleting items in a predictable order. I close this ticket as a duplicate since that is solved by ticket:252.

Note: See TracTickets for help on using tickets.