Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-7686

Fail to migrate to SonarQube 5.5 when some LDAP users was removed then reactivated

    Details

      Description

      Here's how to reproduce this issue :

      • Install the LDAP plugin
      • Log in with a user provided by LDAP
      • Remove this user from SonarQube (but not form LDAP)
      • Log in again with this user

      This user will have its external_identity_provider and external_identity columns to null, then the upgrade to 5.5+ will fail with :

      2016.05.18 10:22:31 INFO  web[o.s.s.d.m.PlatformDatabaseMigration] DB migration failed | time=60830ms
      2016.05.18 10:22:31 ERROR web[o.s.s.d.m.PlatformDatabaseMigration] DB Migration or container restart failed. Process ended with an exception
      java.lang.NullPointerException: null
          at org.sonar.server.startup.FeedUsersLocalStartupTask.updateUsersLocal(FeedUsersLocalStartupTask.java:93) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.startup.FeedUsersLocalStartupTask.start(FeedUsersLocalStartupTask.java:76) ~[sonar-server-5.5.jar:na]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_77]
          at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_77]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_77]
          at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_77]
          at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89) ~[picocontainer-2.15.jar:na]
          at org.sonar.core.platform.ComponentContainer$1.start(ComponentContainer.java:320) ~[sonar-core-5.5.jar:na]
          at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.behaviors.Stored.start(Stored.java:110) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009) ~[picocontainer-2.15.jar:na]
          at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767) ~[picocontainer-2.15.jar:na]
          at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:141) ~[sonar-core-5.5.jar:na]
          at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:84) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.platform.platformlevel.PlatformLevelStartup.access$001(PlatformLevelStartup.java:44) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.platform.platformlevel.PlatformLevelStartup$1.doPrivileged(PlatformLevelStartup.java:78) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.user.DoPrivileged.execute(DoPrivileged.java:44) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.platform.platformlevel.PlatformLevelStartup.start(PlatformLevelStartup.java:75) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.platform.Platform.executeStartupTasks(Platform.java:199) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.platform.Platform.doStart(Platform.java:114) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.platform.Platform.doStart(Platform.java:99) ~[sonar-server-5.5.jar:na]
          at org.sonar.server.db.migrations.PlatformDatabaseMigration.doRestartContainer(PlatformDatabaseMigration.java:138) [sonar-server-5.5.jar:na]
          at org.sonar.server.db.migrations.PlatformDatabaseMigration.doDatabaseMigration(PlatformDatabaseMigration.java:114) [sonar-server-5.5.jar:na]
          at org.sonar.server.db.migrations.PlatformDatabaseMigration.access$000(PlatformDatabaseMigration.java:37) [sonar-server-5.5.jar:na]
          at org.sonar.server.db.migrations.PlatformDatabaseMigration$1.run(PlatformDatabaseMigration.java:101) [sonar-server-5.5.jar:na]
          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_77]
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_77]
          at java.lang.Thread.run(Unknown Source) [na:1.8.0_77]
      

      The workaround is to execute the following SQL query :

      update users set external_identity_provider='sonarqube' where external_identity_provider is null
      

      A migration should be added to execute this query.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julien.lancelot Julien Lancelot
                Reporter:
                julien.lancelot Julien Lancelot
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: