Deadlock while using MySQL or PostgreSQL

Need help? Post your questions here.

Moderator: moderators

Deadlock while using MySQL or PostgreSQL

Postby SpaceFox » Thu Dec 21, 2017 7:49 pm

Hi,

I experience some deadlock on database request if I use MySQL (MariaDB) or PostgreSQL.

Here is a thread dump : https://framabin.org/?3803ad75fecdde5d# ... LrUJvpmN0=

There are 7 threads blocked on this method:

Code: Select all
"btpool0-2255" #4412 prio=5 os_prio=0 tid=0x00007f3b60141000 nid=0x1b2b waiting for monitor entry [0x00007f3b5048b000]
   java.lang.Thread.State: BLOCKED (on object monitor)
   at net.sourceforge.subsonic.dao.UserDao.readRoles(UserDao.java:207)
   - waiting to lock <0x00000000eef05678> (a java.lang.String)
   at net.sourceforge.subsonic.dao.UserDao.access$300(UserDao.java:22)
   at net.sourceforge.subsonic.dao.UserDao$UserRowMapper.mapRow(UserDao.java:290)
   at net.sourceforge.subsonic.dao.UserDao$UserRowMapper.mapRow(UserDao.java:286)
   at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92)
   at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:653)
   at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:591)
   at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:641)
   at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:670)
   at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:678)
   at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:710)
   at net.sourceforge.subsonic.dao.AbstractDao.query(AbstractDao.java:84)
   at net.sourceforge.subsonic.dao.AbstractDao.queryOne(AbstractDao.java:150)
   at net.sourceforge.subsonic.dao.UserDao.getUserByName(UserDao.java:59)
   at net.sourceforge.subsonic.service.SecurityService.getUserByName(SecurityService.java:93)
   at net.sourceforge.subsonic.service.SecurityService.loadUserByUsername(SecurityService.java:47)
   at org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.loadUserDetails(TokenBasedRememberMeServices.java:308)
   at org.acegisecurity.ui.rememberme.TokenBasedRememberMeServices.autoLogin(TokenBasedRememberMeServices.java:218)
   at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:104)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:81)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.basicauth.BasicProcessingFilter.doFilter(BasicProcessingFilter.java:173)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
   at org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:275)
   at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:149)
   at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
   at net.sourceforge.subsonic.filter.RequestEncodingFilter.doFilter(RequestEncodingFilter.java:25)
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
   at net.sourceforge.subsonic.filter.ParameterDecodingFilter.doFilter(ParameterDecodingFilter.java:36)
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
   at net.sourceforge.subsonic.filter.BootstrapVerificationFilter.doFilter(BootstrapVerificationFilter.java:41)
   at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
   at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
   at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
   at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
   at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
   at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
   at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
   at org.mortbay.jetty.Server.handle(Server.java:313)
   at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
   at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
   at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
   at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
   at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
   at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:396)
   at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:442)


When this happen:

  • The server doesn't respond without any kind of log.
  • Each request creates a new thread → thread count increase to ridiculous values.
  • The only solution I found is to restart Subsonic.

Technical details : JRE 8 on Ubuntu 16.04.3 LTS. Enough OS and JVM RAM, nothing specific in any logs, including databases ones. 8 users, 4 of them connect daily.

Sadly I have no way to reproduce this on-demand. This happen randomly, sometimes when only one people is logged.

Please ask if you need more details.
SpaceFox
 
Posts: 1
Joined: Thu Dec 21, 2017 7:13 pm

Return to Help

Who is online

Users browsing this forum: No registered users and 19 guests