Bitbucket Data Center is unable to start after upgrading to 9.2 due to error "secretData cannot be less than 1 characters"
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
After upgrading to Bitbucket 9.2, the instance is unable to start due to the following error: java.lang.IllegalArgumentException: secretData cannot be less than 1 characters
Environment
Bitbucket Data Center 9.2
Diagnosis
The Bitbucket debug logs contain the following entries indicating failure on an upgrade task named core-migrate-mail-password.
1
2
3
4
DEBUG [spring-startup] c.a.s.i.s.u.CreateSystemSigningSecretKeyUpgradeTask Skipping upgrade task to create system signing secret key as this has already been done
DEBUG [spring-startup] c.a.s.i.s.u.AbstractApplicationSecretUpgradeTask Locked upgrade task core-migrate-mail-password.lock
INFO [spring-startup] c.a.s.i.s.u.AbstractApplicationSecretUpgradeTask Starting upgrade task core-migrate-mail-password
WARN [spring-startup] o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'crowdApplicationDao': Unsatisfied dependency expressed through method 'setDirectoryDao' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdDirectoryDao' defined in class path resource [crowd-spi-context.xml]: Cannot resolve reference to bean 'crowdDirectoryPasswordsEncryptor' while setting bean property 'directoryPasswordsEncryptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdDirectoryPasswordsEncryptor' defined in class path resource [crowd-spi-context.xml]: Cannot resolve reference to bean 'crowdSwappableEncryptor' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdEncryptorFactory' defined in class path resource [crowd-spi-context.xml]: Cannot resolve reference to bean 'crowdEncryptionSettings' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'crowdEncryptionSettings' defined in class path resource [crowd-spi-context.xml]: Cannot resolve reference to bean 'applicationPropertiesService' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'applicationSecretsUpgradeTaskRunner': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: secretData cannot be less than 1 characters
The marker file located at $BITBUCKET_HOME/shared/config/upgrades/core-migrate-mail-password does not exist yet. Without this file, the upgrade task will run again on the next startup attempt.
Cause
An upgrade task named core-migrate-mail-password was introduced in Bitbucket Data Center 9.2. It encrypts the mail.password valuestored in the app_property table.
The issue occurs when the mail password is set to a zero-length value. This can be checked by running the following query:
1
select prop_value from app_property where prop_key='mail.password';
A bug has been raised to address this: BSERV-19775 - Bitbucket mail password upgrade task does not handle blank passwords
Solution
Instead of setting mail.password to a blank string, delete the mail.password entry from the app_property table.
1
delete from app_property where prop_key = 'mail.password';
Start Bitbucket after making this change. If Bitbucket is able to start successfully, a new mail.password will be created with a value of {ATL_SECURED}.
The marker file located at $BITBUCKET_HOME/shared/config/upgrades/core-migrate-mail-password will be created as well to prevent this task from being repeated on the next startup.
Was this helpful?