Details
-
Bug
-
Resolution: Fixed
-
Low
-
6.6.0
-
None
-
8
-
Severity 3 - Minor
-
Description
Issue Summary
During setup its possible to double click on some setup steps (e.g. when creating an admin user) and break the installation. Pre 6.7.0, it's possible that the same error was caused by the below bug too (but it will have additional errors)
Steps to Reproduce
- Progress through a Bamboo installation
- When you get to creating an admin user, double click finish (or double tap enter)
Expected Results
Can't submit the form twice and create duplicate entries / break the installation
Actual Results
You get an error in the UI and the below exception is shown in the UI in the atlassian-bamboo.log file.
CWD_APPLICATION.UK_APP_L_NAME
2020-08-07 07:13:37,837 INFO [http-nio-8085-exec-25] [BucketClobStringType] DBMS: h2 2020-08-07 07:13:37,845 ERROR [http-nio-8085-exec-23] [BatchingBatch] HHH000315: Exception executing batch [org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "PUBLIC.UK_APP_L_NAME_INDEX_5 ON PUBLIC.CWD_APPLICATION(LOWER_APPLICATION_NAME) VALUES 32769"; SQL statement: insert into CWD_APPLICATION (APPLICATION_NAME, LOWER_APPLICATION_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, APPLICATION_TYPE, CREDENTIAL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-199]], SQL: insert into CWD_APPLICATION (APPLICATION_NAME, LOWER_APPLICATION_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, APPLICATION_TYPE, CREDENTIAL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?) 2020-08-07 07:13:37,846 WARN [http-nio-8085-exec-23] [SqlExceptionHelper] SQL Error: 23505, SQLState: 23505 2020-08-07 07:13:37,846 ERROR [http-nio-8085-exec-23] [SqlExceptionHelper] Unique index or primary key violation: "PUBLIC.UK_APP_L_NAME_INDEX_5 ON PUBLIC.CWD_APPLICATION(LOWER_APPLICATION_NAME) VALUES 32769"; SQL statement: insert into CWD_APPLICATION (APPLICATION_NAME, LOWER_APPLICATION_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, APPLICATION_TYPE, CREDENTIAL, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-199] 2020-08-07 07:13:37,853 ERROR [http-nio-8085-exec-23] [ExceptionMappingInterceptor] org.hibernate.exception.ConstraintViolationException: could not execute batch javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute batch at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:154) at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181) at org.hibernate.query.internal.AbstractProducedQuery.list(AbstractProducedQuery.java:1514) at org.hibernate.query.internal.AbstractProducedQuery.uniqueResult(AbstractProducedQuery.java:1547) at org.hibernate.query.internal.AbstractProducedQuery.uniqueResultOptional(AbstractProducedQuery.java:1498) at org.hibernate.query.criteria.internal.compile.CriteriaQueryTypeQueryAdapter.uniqueResultOptional(CriteriaQueryTypeQueryAdapter.java:84) at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.findByPropertyOptional(HibernateDao.java:153) at com.atlassian.crowd.util.persistence.hibernate.HibernateDao.findByProperty(HibernateDao.java:165) at com.atlassian.crowd.dao.application.ApplicationDAOHibernate.findByName(ApplicationDAOHibernate.java:112) at com.atlassian.crowd.dao.application.ApplicationDAOHibernate.findByName(ApplicationDAOHibernate.java:36) at com.atlassian.crowd.embedded.core.CrowdEmbeddedApplicationFactory.getApplication(CrowdEmbeddedApplicationFactory.java:23) at com.atlassian.crowd.embedded.EmbeddedCrowdBootstrapImpl.getOrCreateApplication(EmbeddedCrowdBootstrapImpl.java:57) at com.atlassian.crowd.embedded.EmbeddedCrowdBootstrapImpl.initialiseEmbeddedCrowd(EmbeddedCrowdBootstrapImpl.java:44) at com.atlassian.crowd.embedded.EmbeddedCrowdBootstrapImpl.initialiseEmbeddedCrowd(EmbeddedCrowdBootstrapImpl.java:38)
When you restart Bamboo, you are sent back to the admin creation screen. Clicking finish here causes the same problem again on a different table / index CWD_DIRECTORY.UK_DIR_L_NAME:
2020-08-07 07:46:02,380 ERROR [http-nio-8085-exec-16] [BatchingBatch] HHH000315: Exception executing batch [org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "UK_DIR_L_NAME_INDEX_A ON PUBLIC.CWD_DIRECTORY(LOWER_DIRECTORY_NAME) VALUES ('bamboo internal directory', 65537)"; SQL statement: insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-196]], SQL: insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) 2020-08-07 07:46:02,381 WARN [http-nio-8085-exec-16] [SqlExceptionHelper] SQL Error: 23505, SQLState: 23505 2020-08-07 07:46:02,381 ERROR [http-nio-8085-exec-16] [SqlExceptionHelper] Unique index or primary key violation: "UK_DIR_L_NAME_INDEX_A ON PUBLIC.CWD_DIRECTORY(LOWER_DIRECTORY_NAME) VALUES ('bamboo internal directory', 65537)"; SQL statement: insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-196] 2020-08-07 07:46:02,382 ERROR [http-nio-8085-exec-16] [ExceptionMapperStandardImpl] HHH000346: Error during managed flush [org.hibernate.exception.ConstraintViolationException: could not execute batch] 2020-08-07 07:46:02,384 ERROR [http-nio-8085-exec-16] [ExceptionMappingInterceptor] could not execute batch; SQL [insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint ["UK_DIR_L_NAME_INDEX_A ON PUBLIC.CWD_DIRECTORY(LOWER_DIRECTORY_NAME) VALUES ('bamboo internal directory', 65537)"; SQL statement: insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-196]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch org.springframework.dao.DataIntegrityViolationException: could not execute batch; SQL [insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint ["UK_DIR_L_NAME_INDEX_A ON PUBLIC.CWD_DIRECTORY(LOWER_DIRECTORY_NAME) VALUES ('bamboo internal directory', 65537)"; SQL statement: insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-196]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute batch at org.springframework.orm.hibernate5.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:247) at org.springframework.orm.hibernate5.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:785) ... at com.sun.proxy.$Proxy305.initialiseEmbeddedCrowd(Unknown Source) at com.atlassian.bamboo.ww2.actions.setup.SetupUtilityBean.setupUser(SetupUtilityBean.java:212) at com.atlassian.bamboo.ww2.actions.setup.SetupAdminUserAction.execute(SetupAdminUserAction.java:33) ... at java.lang.Thread.run(Thread.java:748) Caused by: org.hibernate.exception.ConstraintViolationException: could not execute batch at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) ... at org.springframework.orm.hibernate5.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:609) ... 180 more Caused by: org.h2.jdbc.JdbcBatchUpdateException: Unique index or primary key violation: "UK_DIR_L_NAME_INDEX_A ON PUBLIC.CWD_DIRECTORY(LOWER_DIRECTORY_NAME) VALUES ('bamboo internal directory', 65537)"; SQL statement: insert into CWD_DIRECTORY (DIRECTORY_NAME, LOWER_DIRECTORY_NAME, CREATED_DATE, UPDATED_DATE, ACTIVE, DESCRIPTION, IMPL_CLASS, LOWER_IMPL_CLASS, DIRECTORY_TYPE, ID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [23505-196] at org.h2.jdbc.JdbcPreparedStatement.executeBatch(JdbcPreparedStatement.java:1234) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:2544) at org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:118) ... 200 more
Workaround
Once this issue has been encountered, you will need to do the entire installation again to a new $BAMBOO_HOME directory and database.