Bamboo "Specs state cleanup" process fails with NullPointerException
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When Bamboo automatically runs the Specs state cleanup process, the process will fail with a NullPointerException.
The process will resume, but the entries with exceptions won't be deleted.
Diagnosis
During the cleanup execution, the following error will be seen in the logs:
2020-11-15 02:00:01,745 INFO [scheduler_Worker-2] [BambooSpecsManagerImpl] Removing orphaned specs states for repository 123456 and branch refs/heads/master
2020-11-15 02:00:01,752 ERROR [scheduler_Worker-2] [BambooSpecsManagerImpl]
java.lang.NullPointerException
at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)
at sun.nio.fs.UnixPath.<init>(UnixPath.java:71)
at sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:281)
at sun.nio.fs.AbstractPath.resolve(AbstractPath.java:53)
at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsLogServiceImpl.getBambooSpecsExecutionLogFile(RepositoryStoredSpecsLogServiceImpl.java:104)
at com.atlassian.bamboo.specs.BambooSpecsManagerImpl.removeRecord(BambooSpecsManagerImpl.java:161)
at com.atlassian.bamboo.specs.BambooSpecsManagerImpl.lambda$removeOrphanedSpecStatesNoTx$0(BambooSpecsManagerImpl.java:145)
at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:384)
at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:350)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:36)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:28)
at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:33)
at com.atlassian.bamboo.specs.BambooSpecsManagerImpl.removeOrphanedSpecStatesNoTx(BambooSpecsManagerImpl.java:129)
(...)
Cause
Bamboo has many internal processes in charge of specs creation and deletion, as well as cleaning up threads. If at some point during any of these executions, something external happens (a DB connection failure, or the server being shut down unexpectedly, or a network failure, etc), then some data will remain corrupted in the database and needs to be manually fixed.
Solution
For the clean-up to work you will need to directly modify data in the database to fix the problem. Please Contact Atlassian Support for guidance on how to fix this, and mention this article for reference.