History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QB-1278
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Robin Shen
Reporter: Siim Käba
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
QuickBuild

Deadlock on configuration delete

Created: 29/May/12 04:53 PM   Updated: 27/Dec/12 12:54 PM
Component/s: None
Affects Version/s: 4.0.40
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: mysql as db


 Description  « Hide
Message: Could not execute JDBC batch update

Root cause:

com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails (`quickbuild`.`QB_BUILD`, CONSTRAINT `FK_BLD_CONF` FOREIGN KEY (`QB_CONFIGURATION_ID`) REFERENCES `QB_CONFIGURATION` (`QB_ID`))
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
at com.mysql.jdbc.Util.getInstance(Util.java:386)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1039)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3597)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3529)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1990)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2151)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2625)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2119)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2415)
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1976)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.jamonapi.proxy.MonProxy.invoke(MonProxy.java:127)
at com.jamonapi.proxy.JDBCMonProxy.invoke(JDBCMonProxy.java:100)
at $Proxy50.executeBatch(Unknown Source)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:189)
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:1216)
at com.pmease.quickbuild.entitymanager.impl.DefaultConfigurationManager.delete(DefaultConfigurationManager.java:148)
at com.pmease.quickbuild.entitymanager.impl.DefaultConfigurationManager.delete(DefaultConfigurationManager.java:1)
at com.pmease.quickbuild.web.page.configuration.ConfigurationPage$6.onClick(ConfigurationPage.java:251)
at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:187)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:272)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:220)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:179)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)
at org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:137)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at com.pmease.quickbuild.web.WebServlet.service(WebServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.equinox.http.helper.FilterServletAdaptor$FilterChainImpl.doFilter(FilterServletAdaptor.java:56)
at org.mortbay.servlet.UserAgentFilter.doFilter(UserAgentFilter.java:78)
at org.mortbay.servlet.GzipFilter.doFilter(GzipFilter.java:131)
at org.eclipse.equinox.http.helper.FilterServletAdaptor.service(FilterServletAdaptor.java:37)
at com.pmease.quickbuild.web.HttpServiceProvider$1$1.service(HttpServiceProvider.java:87)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:317)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:924)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
at org.mortbay.jetty.security.SslSocketConnector$SslConnection.run(SslSocketConnector.java:680)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)


Complete stack:

org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:96)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:189)
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:1216)
at com.pmease.quickbuild.entitymanager.impl.DefaultConfigurationManager.delete(DefaultConfigurationManager.java:148)
at com.pmease.quickbuild.entitymanager.impl.DefaultConfigurationManager.delete(DefaultConfigurationManager.java:1)
at com.pmease.quickbuild.web.page.configuration.ConfigurationPage$6.onClick(ConfigurationPage.java:251)
at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:187)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:272)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:220)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:179)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)

java.sql.BatchUpdateException: Cannot delete or update a parent row: a foreign key constraint fails (`quickbuild`.`QB_BUILD`, CONSTRAINT `FK_BLD_CONF` FOREIGN KEY (`QB_CONFIGURATION_ID`) REFERENCES `QB_CONFIGURATION` (`QB_ID`))
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2024)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1449)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.jamonapi.proxy.MonProxy.invoke(MonProxy.java:127)
at com.jamonapi.proxy.JDBCMonProxy.invoke(JDBCMonProxy.java:100)
at $Proxy50.executeBatch(Unknown Source)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:189)
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:1216)
at com.pmease.quickbuild.entitymanager.impl.DefaultConfigurationManager.delete(DefaultConfigurationManager.java:148)
at com.pmease.quickbuild.entitymanager.impl.DefaultConfigurationManager.delete(DefaultConfigurationManager.java:1)
at com.pmease.quickbuild.web.page.configuration.ConfigurationPage$6.onClick(ConfigurationPage.java:251)
at org.apache.wicket.markup.html.link.Link.onLinkClicked(Link.java:187)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:272)
at org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:220)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:179)
at org.apache.wicket.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:165)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:719)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:63)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:210)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:253)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:162)


 All   Comments   Work Log   Change History      Sort Order:
Siim Käba [29/May/12 05:00 PM]
Sorry, you probably see that my summary is wrong in this description context. I will create another bug when i have more information about the deadlocks during configuration delete, there a many of them.

Robin Shen [29/May/12 11:43 PM]
It seems that some foreign key constraints have been violated in database. I guess you are using MyISAM as MySQL storage engine for QuickBuild database. If so, please switch to InnoDB engine which will enforce foreign key constraints.


Siim Käba [30/May/12 07:49 AM]
Doesn't it look so that quickbuild goes for deleting a configuration when there's still builds related to this table? And the fk constraint avoids deleting it. I think it should be managed from Java.

Robin Shen [30/May/12 10:52 PM]
Yes, you are right. QB tries to delete all builds before deleting the configuration. However in rare cases, a new build might comes in just after QB deleted all existing builds for the configuration, and subsequent deletion of the configuration can result this error. We could have locked the whole deletion process so that no new builds will be created, but the lock might be expensive. So for these rare cases, we just leave it to database to report the error.
Upon such cases, the configuration can normally be deleted successfully if you try to delete again.

Siim Käba [18/Sep/12 07:47 AM]
can be closed, does not seem to happen in 4.0.59 any more.