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

Unable to remove a directory from crowd: could not execute statement

      We tried to remove a directory from crowd (Microsoft Active Directory) but it fails with the "could not execute statement" error.

      Logs show:

      2016-02-02 16:20:58,927 http-bio-18095-exec-4 WARN [engine.jdbc.spi.SqlExceptionHelper] SQL Error: 0, SQLState: 23503
      2016-02-02 16:20:58,927 http-bio-18095-exec-4 ERROR [engine.jdbc.spi.SqlExceptionHelper] ERROR: update or delete on table "cwd_user" violates foreign key constraint "fk_user_attribute_id_user_id" on table "cwd_user_attribute"
        Detail: Key (id)=(16220293) is still referenced from table "cwd_user_attribute".
      2016-02-02 16:20:58,928 http-bio-18095-exec-4 ERROR [console.action.directory.RemoveDirectory] could not execute statement
      org.hibernate.exception.ConstraintViolationException: could not execute statement
      	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)
      	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)
      	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)
      	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)
      	at org.hibernate.hql.internal.ast.exec.BasicExecutor.doExecute(BasicExecutor.java:108)
      

            [CWD-4606] Unable to remove a directory from crowd: could not execute statement

            Patryk added a comment -

            We couldn't reproduce that issue with Crowd 2.9. Could you please verify that you still experience the problem? If you do, please contact support so that we can investigate further.
            Best regards,
            Patryk Petrowski

            Patryk added a comment - We couldn't reproduce that issue with Crowd 2.9. Could you please verify that you still experience the problem? If you do, please contact support so that we can investigate further. Best regards, Patryk Petrowski

            I added an updated version of the SQL script that can remove the directory at the database level.

            I advise Atlassian customers to hire someone to run it every every time it happens again (~3-4 months).

            So far it was impossible for me to make Atlassian recognize the bug.

            Sorin Sbarnea (Citrix) added a comment - I added an updated version of the SQL script that can remove the directory at the database level. I advise Atlassian customers to hire someone to run it every every time it happens again (~3-4 months). So far it was impossible for me to make Atlassian recognize the bug.

            One temporary workaround would be to manually remove the directory from the database, something I had to do every 4-5 months since 2012, for all JIRA, Confluence and Crowd.

            Here is a snippet that could help you perform the ugly removal job which involves more than ten database tables: https://gist.github.com/ssbarnea/2352885

            Sorin Sbarnea (Citrix) added a comment - One temporary workaround would be to manually remove the directory from the database, something I had to do every 4-5 months since 2012, for all JIRA, Confluence and Crowd. Here is a snippet that could help you perform the ugly removal job which involves more than ten database tables: https://gist.github.com/ssbarnea/2352885

              Unassigned Unassigned
              a0ba2216890f William Ing
              Affected customers:
              1 This affects my team
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: