0 Replies Latest reply on Nov 11, 2004 11:52 AM by vatsanc

    JBoss behavior upon detecting a Deadlock

    vatsanc

      We had a situation in which a delete SQL was issued from a session bean to the database (MySQL). The number of rows to be deleted was larger than MySQL could handle (2 Million), so it threw back a SQLException saying it found a Deadlock. Strangely, JBoss kept re-starting the transaction. The same Exception can be found over and over in the JBoss server.log file.
      - Does JBoss indeed re-start the transaction repeatedly when the database detects a deadlock?
      - Is there a way to change this behavior ? if so, how?
      Thanks for you help. The snippet from server.log is pasted below.


      2004-11-08 19:50:41,694 ERROR [com.cpmetrics.session.ContributorMetricsSession] Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; Try restarting transaction"
      java.sql.SQLException: Deadlock found when trying to get lock; Try restarting transaction, message from server: "Lock wait timeout exceeded; Try restarting transaction"
      at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1905)
      at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1109)
      at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1203)
      at com.mysql.jdbc.Connection.execSQL(Connection.java:2103)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1680)
      at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1527)
      at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:324)
      at com.bloomberg.cpmetrics.session.ContributorMetricsBean.deleteCurrentRejectTickerSummary(ContributorMetricsBean.java:667)
      at com.bloomberg.cpmetrics.session.ContributorMetricsBean.deleteCurrentRejectTickerSummaryOnDate(ContributorMetricsBean.java:243)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
      at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:72)
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:267)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:128)
      at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:118)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
      at org.jboss.ejb.StatelessSessionContainer.internalInvoke(StatelessSessionContainer.java:331)
      at org.jboss.ejb.Container.invoke(Container.java:700)
      at sun.reflect.GeneratedMethodAccessor69.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:101)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:90)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
      at org.jboss.proxy.ejb.StatelessSessionInterceptor.invoke(StatelessSessionInterceptor.java:100)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      at $Proxy542.deleteCurrentRejectTickerSummaryOnDate(Unknown Source)
      at com.bloomberg.cpmetrics.interfaces.ContributorMetricsRemote.deleteCurrentRejectTickerSummaryOnDate(ContributorMetricsRemote.java:74)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at bb.common.BaseXmlInvoker.invokeMethod(BaseXmlInvoker.java:304)
      at bb.common.BaseXmlInvoker.service(BaseXmlInvoker.java:70)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
      at org.mortbay.jetty.servlet.Dispatcher.dispatch(Dispatcher.java:220)
      at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:133)
      at bb.bloomberg.dispatcher.servlet.BaseDispatcher.dispatchXml(BaseDispatcher.java:181)
      at bb.bloomberg.dispatcher.servlet.Dispatch.service(Dispatch.java:39)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:356)
      at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:294)
      at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:567)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1776)
      at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:514)
      at org.mortbay.http.HttpContext.handle(HttpContext.java:1726)
      at org.mortbay.http.HttpServer.service(HttpServer.java:879)
      at org.jboss.jetty.Jetty.service(Jetty.java:456)
      at org.mortbay.http.HttpConnection.service(HttpConnection.java:790)
      at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:952)
      at org.mortbay.http.HttpConnection.handle(HttpConnection.java:807)
      at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:196)
      at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:289)
      at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:487)