Audit cleanup job fails with NumberFormatException

Still need help?

The Atlassian Community is here for you.

Ask the community

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

Problem

Every hour, Bitbucket Server runs a job against the database it is connected to in order to cleanup the audit logging.

This job fails and the following appears in atlassian-bitbucket.log:

 

2016-08-29 11:17:30,148 ERROR [Caesium-1-1] c.a.b.i.audit.AuditCleanupJobRunner Audit cleanup failed
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) ~[na:1.8.0_102]
at java.lang.Long.parseLong(Long.java:601) ~[na:1.8.0_102]
at java.lang.Long.parseLong(Long.java:631) ~[na:1.8.0_102]
at com.atlassian.bitbucket.internal.audit.AuditCleanupJobRunner.runJob(AuditCleanupJobRunner.java:54) ~[bitbucket-audit-4.8.3.jar:na]
at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:153) [atlassian-scheduler-core-1.7.0.jar:na]
at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:118) [atlassian-scheduler-core-1.7.0.jar:na]
at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:97) [atlassian-scheduler-core-1.7.0.jar:na]
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:401) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:396) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:349) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:255) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService$1.consume(CaesiumSchedulerService.java:252) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:65) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:59) [atlassian-scheduler-caesium-1.3.0.jar:na]
at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:34) [atlassian-scheduler-caesium-1.3.0.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102]

Diagnosis

Connect to the database being used by Bitbucket Server and run the following query:

select key_value from plugin_setting where namespace = 'bitbucket.global.settings' and key_name = 'audit.cleanup.last.run';

The result should be one row with no value in it.

Cause

The value of plugin_setting.key_value is empty, and an empty String fails to be converted to Long, causing the NumberFormatException. The reason why the value of plugin_setting.key_value is empty is not yet known.

Resolution

Run the following query in order to remove that entry from the database:

delete from plugin_setting where namespace = 'bitbucket.global.settings' and key_name = 'audit.cleanup.last.run';

This should fix the cleanup job, allowing it to run successfully

Last modified on Nov 2, 2018

Was this helpful?

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