Database Corruption - Startup page not reachable - Cannot evaluate master chain
Symptoms
We see this type of errors in the Bamboo logs:
2014-08-18 15:41:30,785 INFO [http-bio-10542-exec-25] [RetryingTaskExecutor] Task 'Retrieving TESTA-TSTA0' threw java.lang.IllegalArgumentException: Cannot evaluate master chain, aborting.
2014-08-18 15:41:30,786 ERROR [http-bio-10542-exec-25] [ExceptionMappingInterceptor] java.lang.IllegalArgumentException: Cannot evaluate master chain
java.lang.RuntimeException: java.lang.IllegalArgumentException: Cannot evaluate master chain
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:120)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl.getPlanByKey(ImmutablePlanManagerImpl.java:129)
at sun.reflect.GeneratedMethodAccessor226.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy68.getPlanByKey(Unknown Source)
at com.atlassian.bamboo.plan.cache.ImmutablePlanCacheServiceImpl$1$1.call(ImmutablePlanCacheServiceImpl.java:97)
at com.atlassian.bamboo.plan.cache.ImmutablePlanCacheServiceImpl$1$1.call(ImmutablePlanCacheServiceImpl.java:89)
at com.atlassian.bamboo.plan.cache.CacheLoadContextSupport.callRethrowingExceptionsAsRuntimeExceptions(CacheLoadContextSupport.java:145)
at com.atlassian.bamboo.plan.cache.CacheLoadContextSupport.access$200(CacheLoadContextSupport.java:21)
at com.atlassian.bamboo.plan.cache.CacheLoadContextSupport$4$1.doInHibernate(CacheLoadContextSupport.java:122)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:370)
...
Caused by: java.lang.IllegalArgumentException: Cannot evaluate master chain
at com.atlassian.bamboo.plan.cache.AbstractImmutableChain.<init>(AbstractImmutableChain.java:84)
at com.atlassian.bamboo.plan.branch.cache.ImmutableChainBranchImpl.<init>(ImmutableChainBranchImpl.java:57)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl.createImmutableChain(ImmutablePlanManagerImpl.java:213)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl.getChainByKey(ImmutablePlanManagerImpl.java:156)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl.access$000(ImmutablePlanManagerImpl.java:49)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl$2.call(ImmutablePlanManagerImpl.java:121)
at com.atlassian.bamboo.plan.cache.ImmutablePlanManagerImpl$2.call(ImmutablePlanManagerImpl.java:117)
at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)
... 291 more
Cause
There are some branches that are orphaned with the main master plan not existing in the database. The error should give a clue as to the branches. In this particular scenario, branch with key TESTA-TSTA0
. This means that the plan with key TESTA-TSTA
is missing.
Resolution
The resolution of this type of database corruptions will be to expire the branches and recreate the master plan once again. It is more logical that way than trying to inject the plan with other key constraints in consideration. This can be done by following the steps below:
- Shut down Bamboo,
Run the query below to see for you self that the master plan is missing. If it exist, you should see a row with the build_type marked as CHAIN
select * from build where full_key like "%TESTA-TSTA%"
After verifying, run this command to expire the branches
update build set marked_for_deletion = 1 where full_key like "%TESTA-TSTA%"
- Restart Bamboo afterwards