Domanda

I am working on the following project and have came across a runtime issue.

http://github.com/dmcquillan314/YouthMinistryHibernate

The instructions to run this project are located in the README.md file although it looks a little messy at the moment. Just view the raw version and it should be readable. Once those steps are completed you should have the environment running.

The issue is on the admin page which is located at:

http://localhost:portno/admin

All accounts are currently being added with a role of admin for testing purposes.

As for steps to recreate the issue see the following:

  1. Signup for a user account it will automatically get the ROLE_ADMIN and ROLE_USER user roles.

  2. Navigate the the /admin url

  3. Add a few groups using the group manager

  4. Attempt to add a text entry and it should freeze up I noticed I didn't see any traffic when i set a breakpoint either which is strange..

  5. If you aren't able to recreate this "freezing" right away then keep trying to create and update different assets it seems to be the page content and events in particular. For now all the controllers are located in the admin controller class until I move them to different controllers.

I've tried several things already to try and fix it such as changing setting around on the session timeout of my db connection pool as well as on hibernate.

I've also tried to set some breakpoints in hopes of seeing where the application freezes however it never seems to get to the breakpoint in the AdminController class that I have set when the error occurs.

The logs are somewhat unhelpful as well here's the last few lines from an instance where it fails:

16:32:19.061 [tomcat-http--13] DEBUG o.s.security.web.FilterChainProxy - /admin/createtextentry reached end of additional filter chain; proceeding with original chain
    16:32:19.061 [tomcat-http--13] DEBUG o.s.web.servlet.DispatcherServlet - DispatcherServlet with name 'appServlet' processing POST request for [/YouthMinistryHibernate/admin/createtextentry]
    16:32:19.061 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Looking up handler method for path /admin/createtextentry
    16:32:19.062 [tomcat-http--13] DEBUG o.s.w.s.m.m.a.RequestMappingHandlerMapping - Returning handler method [public java.lang.String com.youthministry.controller.AdminController.handleCreateTextEntry(com.youthministry.domain.TextEntry,org.springframework.validation.BindingResult,org.springframework.ui.Model)]
    16:32:19.062 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'adminController'
    16:32:19.063 [tomcat-http--13] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Returning cached instance of singleton bean 'txManager'
    16:32:19.063 [tomcat-http--13] DEBUG o.s.o.h.HibernateTransactionManager - Creating new transaction with name [com.youthministry.service.impl.GroupServiceImpl.getGroupById]: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
    16:32:19.063 [tomcat-http--13] DEBUG o.s.o.h.HibernateTransactionManager - Opened new Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[] unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])] for Hibernate transaction
    16:32:19.063 [tomcat-http--13] DEBUG o.s.o.h.HibernateTransactionManager - Preparing JDBC Connection of Hibernate Session [SessionImpl(PersistenceContext[entityKeys=[],collectionKeys=[]];ActionQueue[insertions=[] updates=[] deletions=[] collectionCreations=[] collectionRemovals=[] collectionUpdates=[] unresolvedInsertDependencies=UnresolvedEntityInsertActions[]])]
    16:32:19.063 [tomcat-http--13] DEBUG o.s.jdbc.datasource.DataSourceUtils - Setting JDBC   Connection [org.hibernate.engine.jdbc.internal.proxy.ConnectionProxyHandler@2dd92714[valid=true]] read-only

So far I have learned that it is not a deadlock via my database but rather a deadlock in spring somewhere around the DataSourceUtils when trying to access the Connection ProxyHandler as shown above in the server logs as the last long entry.

I am using Spring 3.1, Hibernate 4.1 and DBCP as my connection pool.

Any help is greatly appreciated I've been struggling with this issue for a week or so now.

È stato utile?

Soluzione

The problem turned out to be a database cardinality issues.

For collections I was using OneToMany instead of ManyToMany where ManyToMany should have been used.

As to why it was hanging as a result I am unsure of. But the important part is that it's fixed now.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top