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

    XMLWordPrintable

Details

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

    Description

      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
      

      Attachments

        Issue Links

          Activity

            People

              justen.stepka@atlassian.com Justen Stepka [Atlassian]
              donna@atlassian.com DonnaA
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: