Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-13728

System service user does not exist error on Bitbucket Server logs

    XMLWordPrintable

Details

    Description

      Issue Summary

      When starting up Bitbucket Data Center/Server, an error "System service user does not exist." is logged. This issue occurs when the system service user is not successfully created by Bitbucket during the Bitbucket upgrade on the sta_service_user table.

      Steps to Reproduce

      This affects the Bitbucket versions 7.7+ since the below change was added on Bitbucket 7.7

      • Currently the reason when this could happen is unclear
      • Removing the System service user manually from the sta_service_user table but leaving the marker file core-system-user on the <BITBUCKET_SHARED>/config/upgrades directory would throw the below exception while the Bitbucket DC/Server starts up.

      Expected Results

      1. Upgrade from 7.6.+ versions to 7.7.+ or 8.x version
      2. Create System service User Upgrade task would be run during the startup and the system service user would be created on the sta_service_user table
      3. A marker file core-system-user is created on the <BITBUCKET_SHARED>/config/upgrades indicating the System Service user was created successfully by the Upgrade task

      Actual Results

      1. A marker file core-system-user is created on the <BITBUCKET_SHARED>/config/upgrades indicating the System Service user was created successfully by the Upgrade task however the System Service User itself isn't created and the logs throw the below error on startup.

      The below exception is thrown in the atlassian-bitbucket.log file:

      2023-03-21 10:32:55,028 ERROR [Caesium-1-3]  c.a.scheduler.core.JobLauncher Scheduled job with ID 'AutoDeclineJob' failed
      java.lang.IllegalStateException: System service user does not exist.
      	at com.atlassian.stash.internal.user.DefaultUserService.getSystemServiceUser(DefaultUserService.java:300)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at jdk.internal.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at com.atlassian.stash.internal.autodecline.DefaultAutoDeclineService.declineInactivePullRequests(DefaultAutoDeclineService.java:87)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at jdk.internal.reflect.GeneratedMethodAccessor181.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at com.atlassian.stash.internal.autodecline.AutoDeclineJob$AutoDeclineJobRunner.runJob(AutoDeclineJob.java:84)
      	at com.atlassian.stash.internal.scheduling.FeatureAwareJobRunner.runJob(FeatureAwareJobRunner.java:42)
      	at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
      	at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
      	at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454)
      	at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
      	at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
      	at java.base/java.lang.Thread.run(Unknown Source)
      	... 44 frames trimmed
      

      Workaround

      • Delete or move the file $BITBUCKET_HOME/shared/config/upgrades/core-system-user
      • Restart Bitbucket service and check the logs for the below entry while its starting up
        2023-03-22 15:41:04,815 INFO  [spring-startup]  c.a.s.i.u.u.CreateSystemUserUpgradeTask Successfully created system service user
        
      • Deleting the $BITBUCKET_HOME/shared/config/upgrades/core-system-user file should trigger the upgrade task while the Bitbucket starts up and the system service would be successfully created on the sta_service_user table as expected.

      Attachments

        Activity

          People

            Unassigned Unassigned
            5338c0aa34f9 Danny Samuel
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: