Opened 14 years ago

Closed 14 years ago

#1507 closed defect (fixed)

Burp trying to empty trashcan

Reported by: Jari Häkkinen Owned by: Martin Svensson
Priority: minor Milestone: BASE 2.16
Component: core Version: 2.15
Keywords: Cc:

Description

I am trying to empty my trashcan with one item only. An empty group. The group was created during migration from BASE 1.

Version  	BASE 2.15.0 (build #5317; schema #79)
Web server 	Apache Tomcat/6.0.20
Database Server 	MySQL 5.0.51a-log
Database Dialect 	org.hibernate.dialect.MySQLInnoDBDialect
JDBC Driver 	com.mysql.jdbc.Driver (version 5.1)
Java runtime 	Java(TM) SE Runtime Environment (1.6.0_04-b12), Sun Microsystems Inc.
Operating system 	Linux i386 2.6.18-53.1.14.el5PAE
Memory 	Total: 254.6 MB
Free: 138.6 MB
Max: 986.1 MB
Browser 	Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8
Error message 	Cannot delete or update a parent row: a foreign key constraint fails (`onk/DiskUsage`, CONSTRAINT `FK7C6F99E4F03758FA` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`id`))
Stack trace 	

DatabaseException
...at HibernateUtil.commit(HibernateUtil.java:1041)
...at DbControl.commit(DbControl.java:436)
...at Trashcan.delete(Trashcan.java:264)
...at org.apache.jsp.views.trashcan.index_jsp._jspService(index_jsp.java:288)
...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)

...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:70)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
...at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
...at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
...at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
...at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
...at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
...at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
...at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
...at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
...at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
...at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
...at java.lang.Thread.run(Thread.java:619)

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`onk/DiskUsage`, CONSTRAINT `FK7C6F99E4F03758FA` FOREIGN KEY (`group_id`) REFERENCES `Groups` (`id`))
...at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
...at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
...at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
...at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
...at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
...at com.mysql.jdbc.Util.getInstance(Util.java:381)
...at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
...at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
...at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536)
...at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468)
...at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
...at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1333)
...at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:843)
...at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2371)
...at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2289)
...at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2274)
...at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
...at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2694)
...at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2895)
...at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)
...at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:268)
...at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:260)
...at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184)
...at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
...at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
...at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1206)
...at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:375)
...at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
...at HibernateUtil.commit(HibernateUtil.java:1036)
...at DbControl.commit(DbControl.java:436)
...at Trashcan.delete(Trashcan.java:264)
...at org.apache.jsp.views.trashcan.index_jsp._jspService(index_jsp.java:288)
...at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
...at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
...at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
...at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...at net.sf.basedb.clients.web.servlet.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:70)
...at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
...at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
...at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
...at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
...at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
...at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
...at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
...at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
...at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
...at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
...at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769)
...at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698)
...at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891)
...at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
...at java.lang.Thread.run(Thread.java:619)

Change History (5)

comment:1 by Nicklas Nordborg, 14 years ago

Milestone: BASE 2.16
Priority: majorminor

It is possible to trigger this error by the following procedure.

  1. Create group G and assign a quota to it.
  2. Create a user U and select G as it's quota group.
  3. Login as user U and upload a file F.
  4. Login as root and modify U so that it no longer has G as the quota group.
  5. Delete G.
  6. Go to the trashcan and try to empty it. The above error message is displayed.

The reason for the error is that the quota information for the file F is still referencing group G since that was the "active" quota group when the file was uploaded. I don't think this should block the deletion of the group so the proper fix is to nullify the reference in the DiskUsage table whenever a group is deleted. Something like the following HQL should be implemented in the Group.onBeforeCommit() method when a group is deleted:

update DiskUsageData set group = null where group = <id-of-group>

comment:2 by Martin Svensson, 14 years ago

Owner: changed from everyone to Martin Svensson
Status: newassigned

in reply to:  1 comment:3 by Jari Häkkinen, 14 years ago

Replying to nicklas:

Will the dereferencing be done immediately when the group is marked as deleted or when the group is deleted permanently? What I am getting at is it possible to restore a group completely from trash or are references lost.

comment:4 by Nicklas Nordborg, 14 years ago

It will happen when the deleting it from the trash.

comment:5 by Martin Svensson, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [5403]) Fixes #1507. Burp trying to empty trashcan.

Note: See TracTickets for help on using tickets.