|
Hi Igor,
This I don't think this is the reason for the exception, after all it reports the same identifier withing one session. Caused by: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 13177238, The first reported problem is a bug. It happens because we use the collection from the cache that is already associated with an open hibernate session and try to attach it to a new session. Hi Anatoli,
Yes, the second issue looks like USER-239. We are using Confluence 2.8, which shipped with atlassian user 1.27. I'll upgrade to the latest version and check if we still see the issue. The first problem is very likely caused by USER-228. Caching persistent objects is really a bad idea, especially if they are still attached to a session that retrieved them from the database. We have hundreds of exceptions in our logs because of this issue. It would be great if it got fixed soon. For now the workaround that I described earlier (using session.evict()) works, but that's pretty ugly. Thanks for looking into this! /i |
||||||||||||||||||||||||||||||||||||||||||||||||||||
But there is one more problem. If two threads (with different hibernate sessions) obtain two instances of the same user (when the cache is empty) and try to save them an exception is thrown:
org.springframework.orm.hibernate.HibernateSystemException: a different object with the same identifier value was already associated with the session: 13177238, of class: com.atlassian.user.impl.hibernate.DefaultHibernateUser; nested exception is net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 13177238, of class: com.atlassian.user.impl.hibernate.DefaultHibernateUser Caused by: net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 13177238, of class: com.atlassian.user.impl.hibernate.DefaultHibernateUser at net.sf.hibernate.impl.SessionImpl.checkUniqueness(SessionImpl.java:1687) at net.sf.hibernate.impl.SessionImpl.doUpdateMutable(SessionImpl.java:1453) at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1480) at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1403) at org.springframework.orm.hibernate.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:604) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370) at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:601) at com.atlassian.user.impl.hibernate.HibernateUserManager.saveUser(HibernateUserManager.java:171) at com.atlassian.user.impl.cache.CachingUserManager.saveUser(CachingUserManager.java:143) at com.atlassian.user.impl.delegation.DelegatingUserManager.saveUser(DelegatingUserManager.java:144) at bucket.user.DefaultUserAccessor.saveUser(DefaultUserAccessor.java:224) at sun.reflect.GeneratedMethodAccessor886.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:177) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144) at com.atlassian.spring.interceptors.SpringProfilingInterceptor.invoke(SpringProfilingInterceptor.java:20) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy22.saveUser(Unknown Source) at com.sun.dse.wikis.auth.ConfluenceUserManager$1.doInHibernate(ConfluenceUserManager.java:96) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370) at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337) at com.sun.dse.wikis.auth.ConfluenceUserManager.updateUser(ConfluenceUserManager.java:79) at com.sun.dse.wikis.auth.SsoFilter.doFilter(SsoFilter.java:124) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185) at com.atlassian.confluence.util.ClusterHeaderFilter.doFilter(ClusterHeaderFilter.java:35) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185) at com.atlassian.johnson.filters.AbstractJohnsonFilter.doFilter(AbstractJohnsonFilter.java:72) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:217) at org.apache.catalina.core.AppliTo me it looks like UserAccessor#getUser(String name) should be synchronized on the name object in order to avoid this.