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

InvalidClassException on Notification class during DB migration process

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: Database, Notifications
    • Labels:
      None

      Description

      The following error can happen during a DB migration:

      2013.09.26 18:09:32 ERROR o.s.s.n.NotificationService  Error in NotificationService
      org.sonar.api.utils.SonarException: Unable to read notification
              at org.sonar.core.notification.db.NotificationQueueDto.toNotification(NotificationQueueDto.java:96) ~[sonar-core-3.7.2-SNAPSHOT.jar:na]
              at org.sonar.core.notification.DefaultNotificationManager.getFromQueue(DefaultNotificationManager.java:95) ~[sonar-core-3.7.2-SNAPSHOT.jar:na]
              at org.sonar.server.notifications.NotificationService.processQueue(NotificationService.java:129) ~[classes/:na]
              at org.sonar.server.notifications.NotificationService$1.run(NotificationService.java:102) ~[classes/:na]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0-u8-b05]
              at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351) [na:1.7.0-u8-b05]
              at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178) [na:1.7.0-u8-b05]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) [na:1.7.0-u8-b05]
              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.7.0-u8-b05]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0-u8-b05]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [na:1.7.0-u8-b05]
              at java.lang.Thread.run(Thread.java:722) [na:1.7.0-u8-b05]
      Caused by: java.io.InvalidClassException: org.sonar.api.notifications.Notification; local class incompatible: stream classdesc serialVersionUID = -1832871365602170277, local class serialVersionUID = 5663918219149894048
              at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:604) ~[na:1.7.0-u8-b05]
              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1601) ~[na:1.7.0-u8-b05]
              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1514) ~[na:1.7.0-u8-b05]
              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1750) ~[na:1.7.0-u8-b05]
              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1347) ~[na:1.7.0-u8-b05]
              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:369) ~[na:1.7.0-u8-b05]
              at org.sonar.core.notification.db.NotificationQueueDto.toNotification(NotificationQueueDto.java:91) ~[sonar-core-3.7.2-SNAPSHOT.jar:na]
              ... 11 common frames omitted
      

      This happens when:

      • the Notification class was modified since the last deployed version of SonarQube
      • there were notifications left in the DB when shutting down the server to operation the migration

      This is due to the fact that the Notification class is serialized to store notifications in the DB.

      What should be done:

      • add serialversionid in the Notification class
      • only log a simple and clear warning message (not an error with the stacktrace) in case the InvalidClassException happens
        • the message could be: "It is impossible to send pending notifications which existed prior to the upgrade of SonarQube. They will be ignored."

        Attachments

          Activity

            People

            Assignee:
            henryju OLD - Julien HENRY
            Reporter:
            fabemn OLD - Fabrice Bellingard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Due:
              Created:
              Updated:
              Resolved: