Uploaded image for project: 'Crowd Data Center'
  1. Crowd Data Center
  2. CWD-698

Session gets out of synch with db in method removePrincipal in ServerSecurityClient

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Medium Medium
    • None
    • 1.2.1
    • None
    • None

      Seeing fun stuff like this in the logs:

      22:08:02,222 ERROR org.codehaus.xfire.handler.DefaultFaultHandler: Fault occurred!
      org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.crowd.integration.model.RemotePrincipal#component[directoryID,name]{directoryID=65537, name=novygees}]; SQL [delete from `REMOTEPRINCIPAL` where `DIRECTORYID`=? and `NAME`=?]; Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`)); nested exception is java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
      java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
      

      This may be a result of using MySQLInnoDB as mentioned in the MySQL docs:

      If you use a multiple-table UPDATE statement involving InnoDB tables for which there are foreign key constraints, the MySQL optimizer might process tables in an order that differs from that of their parent/child relationship. In this case, the statement fails and rolls back. Instead, update a single table and rely on the ON UPDATE capabilities that InnoDB provides to cause the other tables to be modified accordingly. See Section 12.2.6.4, "FOREIGN KEY Constraints"

      Currently, you cannot update a table and select from the same table in a subquery.

      10:03:49,351 ERROR org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session
      org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
      at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
      at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
      at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24)
      at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2520)
      at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
      at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
      at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
      at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
      at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
      at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
      at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
      at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:811)
      at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
      at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:809)
      at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.remove(HibernateDao.java:53)
      at com.atlassian.crowd.model.principal.PrincipalDAOHibernate.remove(PrincipalDAOHibernate.java:200)
      at com.atlassian.crowd.integration.directory.internal.InternalDirectory.removePrincipal(InternalDirectory.java:659)
      at com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.removePrincipal(DirectoryManagerGeneric.java:726)
      at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.refl
      

            [CWD-698] Session gets out of synch with db in method removePrincipal in ServerSecurityClient

            Monique Khairuliana (Inactive) made changes -
            Workflow Original: Simplified Crowd Development Workflow v2 - restricted [ 1508486 ] New: JAC Bug Workflow v3 [ 3364134 ]
            Owen made changes -
            Workflow Original: Simplified Crowd Development Workflow v2 [ 1389432 ] New: Simplified Crowd Development Workflow v2 - restricted [ 1508486 ]
            Owen made changes -
            Workflow Original: Crowd Development Workflow v2 [ 272922 ] New: Simplified Crowd Development Workflow v2 [ 1389432 ]
            jawong.adm made changes -
            Workflow Original: JIRA Bug Workflow v2 [ 174049 ] New: Crowd Development Workflow v2 [ 272922 ]
            Justin Koke made changes -
            Workflow Original: jira [ 119104 ] New: JIRA Bug Workflow v2 [ 174049 ]
            DonnaA made changes -
            Resolution New: Duplicate [ 3 ]
            Status Original: Open [ 1 ] New: Closed [ 6 ]

            DonnaA added a comment -

            This issue is actually larger than just the removePrincipal method. As a result, I'm closing this issue and have opened a more generic StaleStateException issue (CWD-758).

            DonnaA added a comment - This issue is actually larger than just the removePrincipal method. As a result, I'm closing this issue and have opened a more generic StaleStateException issue ( CWD-758 ).
            DonnaA made changes -
            Link New: This issue is superseded by CWD-758 [ CWD-758 ]
            DonnaA made changes -
            Description Original: Seeing fun stuff like this in the logs:

            {code}
            22:08:02,222 ERROR org.codehaus.xfire.handler.DefaultFaultHandler: Fault occurred!
            org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.crowd.integration.model.RemotePrincipal#component[directoryID,name]{directoryID=65537, name=novygees}]; SQL [delete from `REMOTEPRINCIPAL` where `DIRECTORYID`=? and `NAME`=?]; Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`)); nested exception is java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            {code}

            This may be a result of using MySQLInnoDB as mentioned in the [MySQL docs|http://dev.mysql.com/doc/refman/5.0/en/update.html]:


            _If you use a multiple-table UPDATE statement involving InnoDB tables for which there are foreign key constraints, the MySQL optimizer might process tables in an order that differs from that of their parent/child relationship. In this case, the statement fails and rolls back. Instead, update a single table and rely on the ON UPDATE capabilities that InnoDB provides to cause the other tables to be modified accordingly. See Section 12.2.6.4, "FOREIGN KEY Constraints"_

            _Currently, you cannot update a table and select from the same table in a subquery._

            {code}
            10:03:49,351 ERROR org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session
            org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
            at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
            at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
            at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2520)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
            at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
            at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
            at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
            at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
            at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
            at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:811)
            at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
            at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:809)
            at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.remove(HibernateDao.java:53)
            at com.atlassian.crowd.model.principal.PrincipalDAOHibernate.remove(PrincipalDAOHibernate.java:200)
            at com.atlassian.crowd.integration.directory.internal.InternalDirectory.removePrincipal(InternalDirectory.java:659)
            at com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.removePrincipal(DirectoryManagerGeneric.java:726)
            at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.refl
            New: Seeing fun stuff like this in the logs:

            {code}
            22:08:02,222 ERROR org.codehaus.xfire.handler.DefaultFaultHandler: Fault occurred!
            org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.crowd.integration.model.RemotePrincipal#component[directoryID,name]{directoryID=65537, name=novygees}]; SQL [delete from `REMOTEPRINCIPAL` where `DIRECTORYID`=? and `NAME`=?]; Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`)); nested exception is java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            {code}

            This may be a result of using MySQLInnoDB as mentioned in the [MySQL docs|http://dev.mysql.com/doc/refman/5.0/en/update.html]:


            _If you use a multiple-table UPDATE statement involving InnoDB tables for which there are foreign key constraints, the MySQL optimizer might process tables in an order that differs from that of their parent/child relationship. In this case, the statement fails and rolls back. Instead, update a single table and rely on the ON UPDATE capabilities that InnoDB provides to cause the other tables to be modified accordingly. See Section 12.2.6.4, "FOREIGN KEY Constraints"_

            _Currently, you cannot update a table and select from the same table in a subquery._

            {code}
            10:03:49,351 ERROR org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session
            org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
            at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
            at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
            at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2520)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
            at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
            at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
            at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
            at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
            at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
            at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:811)
            at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
            at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:809)
            at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.remove(HibernateDao.java:53)
            at com.atlassian.crowd.model.principal.PrincipalDAOHibernate.remove(PrincipalDAOHibernate.java:200)
            at com.atlassian.crowd.integration.directory.internal.InternalDirectory.removePrincipal(InternalDirectory.java:659)
            at com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.removePrincipal(DirectoryManagerGeneric.java:726)
            at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.refl
            {code}
            DonnaA made changes -
            Description Original: Seeing fun stuff like this in the logs:

            {code}
            22:08:02,222 ERROR org.codehaus.xfire.handler.DefaultFaultHandler: Fault occurred!
            org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.crowd.integration.model.RemotePrincipal#component[directoryID,name]{directoryID=65537, name=novygees}]; SQL [delete from `REMOTEPRINCIPAL` where `DIRECTORYID`=? and `NAME`=?]; Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`)); nested exception is java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            {code}

            This may be a result of using MySQLInnoDB as mentioned in the [MySQL docs|
              http://dev.mysql.com/doc/refman/5.0/en/update.html]:


            _If you use a multiple-table UPDATE statement involving InnoDB tables for which there are foreign key constraints, the MySQL optimizer might process tables in an order that differs from that of their parent/child relationship. In this case, the statement fails and rolls back. Instead, update a single table and rely on the ON UPDATE capabilities that InnoDB provides to cause the other tables to be modified accordingly. See Section 12.2.6.4, "FOREIGN KEY Constraints"_

            _Currently, you cannot update a table and select from the same table in a subquery._

            {code}
            10:03:49,351 ERROR org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session
            org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
            at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
            at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
            at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2520)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
            at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
            at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
            at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
            at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
            at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
            at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:811)
            at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
            at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:809)
            at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.remove(HibernateDao.java:53)
            at com.atlassian.crowd.model.principal.PrincipalDAOHibernate.remove(PrincipalDAOHibernate.java:200)
            at com.atlassian.crowd.integration.directory.internal.InternalDirectory.removePrincipal(InternalDirectory.java:659)
            at com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.removePrincipal(DirectoryManagerGeneric.java:726)
            at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            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 org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:104)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy7.removePrincipal(Unknown Source)
            at com.atlassian.crowd.manager.application.ApplicationManagerGeneric.removePrincipal(ApplicationManagerGeneric.java:1160)
            at com.atlassian.crowd.service.soap.SecurityServerGeneric.removePrincipal(SecurityServerGeneric.java:410)
            at sun.reflect.GeneratedMethodAccessor347.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            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 org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
            at org.springframework.orm.hibernate3.HibernateInterceptor.invoke(HibernateInterceptor.java:104)
            at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
            at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
            at $Proxy9.removePrincipal(Unknown Source)
            at sun.reflect.GeneratedMethodAccessor347.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:59)
            at org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(ServiceInvocationHandler.java:320)
            at org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceInvocationHandler.java:86)
            at org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(ServiceInvocationHandler.java:134)
            at org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:109)
            at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131)
            at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64)
            at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
            at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:304)
            at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:129)
            at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:154)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:92)
            at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106)
            at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
            at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
            at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
            at com.atlassian.core.filters.gzip.GzipFilter.doFilter(GzipFilter.java:59)
            at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70)
            at com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:188)
            at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173)
            at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229)
            at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:420)
            at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511)
            at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:520)
            at com.caucho.util.ThreadPool.run(ThreadPool.java:442)
            at java.lang.Thread.run(Thread.java:595)
            {code}


            New: Seeing fun stuff like this in the logs:

            {code}
            22:08:02,222 ERROR org.codehaus.xfire.handler.DefaultFaultHandler: Fault occurred!
            org.springframework.dao.DataIntegrityViolationException: Hibernate operation: could not delete: [com.atlassian.crowd.integration.model.RemotePrincipal#component[directoryID,name]{directoryID=65537, name=novygees}]; SQL [delete from `REMOTEPRINCIPAL` where `DIRECTORYID`=? and `NAME`=?]; Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`)); nested exception is java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            java.sql.SQLException: Cannot delete or update a parent row: a foreign key constraint fails (`crowddb/REMOTEGROUPMEMBERS`, CONSTRAINT `FKF8D0F100F19C38AE` FOREIGN KEY (`REMOTEPRINCIPALDIRECTORYID`, `REMOTEPRINCIPALNAME`) REFERENCES `REMOTEPRINCIPAL` (`DIRECTORYID`, `NAME`))
            {code}

            This may be a result of using MySQLInnoDB as mentioned in the [MySQL docs|http://dev.mysql.com/doc/refman/5.0/en/update.html]:


            _If you use a multiple-table UPDATE statement involving InnoDB tables for which there are foreign key constraints, the MySQL optimizer might process tables in an order that differs from that of their parent/child relationship. In this case, the statement fails and rolls back. Instead, update a single table and rely on the ON UPDATE capabilities that InnoDB provides to cause the other tables to be modified accordingly. See Section 12.2.6.4, "FOREIGN KEY Constraints"_

            _Currently, you cannot update a table and select from the same table in a subquery._

            {code}
            10:03:49,351 ERROR org.hibernate.event.def.AbstractFlushingEventListener: Could not synchronize database state with session
            org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
            at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
            at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
            at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:24)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2520)
            at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
            at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
            at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
            at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
            at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
            at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
            at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
            at org.springframework.orm.hibernate3.HibernateTemplate$27.doInHibernate(HibernateTemplate.java:811)
            at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372)
            at org.springframework.orm.hibernate3.HibernateTemplate.flush(HibernateTemplate.java:809)
            at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.remove(HibernateDao.java:53)
            at com.atlassian.crowd.model.principal.PrincipalDAOHibernate.remove(PrincipalDAOHibernate.java:200)
            at com.atlassian.crowd.integration.directory.internal.InternalDirectory.removePrincipal(InternalDirectory.java:659)
            at com.atlassian.crowd.manager.directory.DirectoryManagerGeneric.removePrincipal(DirectoryManagerGeneric.java:726)
            at sun.reflect.GeneratedMethodAccessor377.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.refl

              justen.stepka@atlassian.com Justen Stepka [Atlassian]
              donna@atlassian.com DonnaA
              Affected customers:
              0 This affects my team
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: