Backup is failling due to NPE in the user commits table

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Bamboo export fails to complete the backup process and the server just crashes. The following appears in the log files:

24 12:43:56,501 INFO [http-bio-8085-exec-17] [XmlMigrator] Unmounted /home/sultan/bamboo-home/exports/export.zip
2015-04-24 12:43:56,503 INFO [http-bio-8085-exec-17] [ServerLifecycleManagerImpl] Server state changed to 'RUNNING' from 'PAUSED' by 'sultan'
2015-04-24 12:43:56,503 ERROR [http-bio-8085-exec-17] [Export] org.springframework.orm.hibernate.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.atlassian.bamboo.commit.CommitImpl.setForeignCommit; nested exception is net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.atlassian.bamboo.commit.CommitImpl.setForeignCommit
org.springframework.orm.hibernate.HibernateSystemException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.atlassian.bamboo.commit.CommitImpl.setForeignCommit; nested exception is net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.atlassian.bamboo.commit.CommitImpl.setForeignCommit
	at org.springframework.orm.hibernate.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:598)
	at org.springframework.orm.hibernate.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:353)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:375)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:337)
	at com.atlassian.bamboo.persistence3.BambooHibernateObjectDao.executeReturnLong(BambooHibernateObjectDao.java:102)
	at com.atlassian.bamboo.commit.CommitHibernateDao.scrollCommitsForExport(CommitHibernateDao.java:40)
	at sun.reflect.GeneratedMethodAccessor64220.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:98)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:95)
.
.
.
Caused by: net.sf.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.atlassian.bamboo.commit.CommitImpl.setForeignCommit
	at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:220)
	at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2226)
	at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:319)
	at net.sf.hibernate.loader.Loader.loadSingleRow(Loader.java:165)
	at net.sf.hibernate.hql.QueryTranslator.loadSingleRow(QueryTranslator.java:182)
	at net.sf.hibernate.impl.ScrollableResultsImpl.prepareCurrentRow(ScrollableResultsImpl.java:412)
	at net.sf.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:94)
	at org.springframework.orm.hibernate.ScrollHibernateCallback.doInHibernate(ScrollHibernateCallback.java:53)
	at org.springframework.orm.hibernate.ScrollHibernateCallback.doInHibernate(ScrollHibernateCallback.java:13)
	at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)
	... 270 more
Caused by: net.sf.cglib.beans.BulkBeanException
	at com.atlassian.bamboo.commit.CommitImpl$$BulkBeanByCGLIB$$5b90e0f.setPropertyValues(<generated>)
	at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:215)
	... 279 more
Caused by: java.lang.NullPointerException
	... 281 more

 

Cause

The root cause of this issue is that the user_commit  table has a column foreign_commit which can only accept a boolean value (true or false). Now if you have some builds with the user commit saved with a null value for that column, then bamboo complains and fails with the NPE above. Below is the current definition of the table on a mysql database: 

show create table USER_COMMIT;

The response that shows the table definition is below:

CREATE TABLE `USER_COMMIT` (
  `COMMIT_ID` bigint(20) NOT NULL,
  `REPOSITORY_CHANGESET_ID` bigint(20) DEFAULT NULL,
  `AUTHOR_ID` bigint(20) DEFAULT NULL,
  `COMMIT_DATE` datetime DEFAULT NULL,
  `COMMIT_REVISION` varchar(4000) DEFAULT NULL,
  `COMMIT_COMMENT_CLOB` longtext,
  `FOREIGN_COMMIT` bit(1) NOT NULL DEFAULT b'0',
  PRIMARY KEY (`COMMIT_ID`),
  KEY `commit_authorId` (`AUTHOR_ID`),
  KEY `commit_repositoryChangesetId` (`REPOSITORY_CHANGESET_ID`),
  KEY `commit_rev_idx` (`COMMIT_REVISION`(255)),
  KEY `FKF8936C2BD283B32B` (`REPOSITORY_CHANGESET_ID`),
  KEY `FKF8936C2B64E003F0` (`AUTHOR_ID`),
  CONSTRAINT `FKF8936C2B64E003F0` FOREIGN KEY (`AUTHOR_ID`) REFERENCES `AUTHOR` (`AUTHOR_ID`),
  CONSTRAINT `FKF8936C2BD283B32B` FOREIGN KEY (`REPOSITORY_CHANGESET_ID`) REFERENCES `REPOSITORY_CHANGESET` (`REPOSITORY_CHANGESET_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

 

 

Resolution

 Shutdown bamboo, run the below query and restart bamboo to fix the issue

update USER_COMMIT set foreign_commit = false where foreign_commit is Null;
Last modified on May 13, 2015

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.