Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-25345

Universal plugin manager throws class cast exception after upgrading it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Medium
    • None
    • 8.20.17
    • None

    Description

      Problem

      Jira throws a class cast exception when both below conditions are true:

      1. The license cache is flushed
      2. Universal plugin manager is upgraded to a release greater than the bundled version

      Since the UPM is a bundled plugin, it's present in OSGI bundles. Because UPM gets upgraded, the newer version exists in installed plugins directory and is generally used in Jira by default.

      Jira rebuilds its cache when an event causes it to flush the license cache (plugin installation for example) , it temporarily falls back to using bundled plugin classes. Once the installed UPM plugin is available again, it starts using its classes, causing class cast exceptions (the cast mismatch comes from the cache built with an older/different class(bundled) than the one coming from the upgraded plugin).

       Stacktrace example

      2023-10-05 10:09:27,739+0000 http-nio-8080-exec-7 INFO admin 609x1533x1 kkz23l 172.29.221.212,10.9.178.29 /rest/plugins/applications/1.0/installed/jira-software/license [c.a.cache.event.HostLicenseCache] Cache HostLicenseCache was flushed
      2023-10-05 10:09:48,151+0000 http-nio-8080-exec-2 INFO anonymous 609x1543x1 - 10.9.178.29 /status [c.a.jira.servlet.ApplicationStateResolverImpl] Checking index consistency. Time taken: 465.3 <CE><BC>s
      2023-10-05 10:09:58,529+0000 http-nio-8080-exec-29 WARN admin 609x1550x1 kkz23l 172.29.221.212,10.9.178.29 /plugins/servlet/applications/versions-licenses [c.atlassian.ozymandias.SafePluginPointAccess] Unable to run plugin code because of 'java.lang.ClassCastException - class com.atlassian.upm.api.util.Option$1 cannot be cast to class com.atlassian.upm.api.util.Option (com.atlassian.upm.api.util.Option$1 is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @2f7bcff4; com.atlassian.upm.api.util.Option is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @5b8bdb1a)'.
      2023-10-05 10:09:58,533+0000 http-nio-8080-exec-29 ERROR admin 609x1550x1 kkz23l 172.29.221.212,10.9.178.29 /plugins/servlet/applications/versions-licenses [c.a.plugin.web.DefaultWebInterfaceManager] Could not evaluate condition 'com.atlassian.plugin.web.conditions.AndCompositeCondition@654b65f2' for descriptor: com.atlassian.bonfire.plugin:bonfire-settings-link (null)
      java.lang.ClassCastException: class com.atlassian.upm.api.util.Option$1 cannot be cast to class com.atlassian.upm.api.util.Option (com.atlassian.upm.api.util.Option$1 is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @2f7bcff4; com.atlassian.upm.api.util.Option is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @5b8bdb1a)
              at com.atlassian.upm.license.internal.impl.PluginLicenseRepositoryImpl.getCachedLicense(PluginLicenseRepositoryImpl.java:332)
              at com.atlassian.upm.license.internal.impl.PluginLicenseRepositoryImpl.getPluginLicense(PluginLicenseRepositoryImpl.java:148)
              at com.atlassian.upm.license.internal.impl.PluginLicenseManagerImpl.getLicense(PluginLicenseManagerImpl.java:42)
              at jdk.internal.reflect.GeneratedMethodAccessor704.invoke(Unknown Source) 

      Environment

      Jira server/datacenter

      Steps to Reproduce

      • Upgrade Jira universal plugin manager
      • Trigger license cache rebuild (install plugins , clear application license)
      • Any navigation action that verifies the application license (visit user administration for example) will trigger an exception and put the system in unusable state. 

      Expected Results

      Jira is supposed to upgrade UPM and doesn't break the application's license cache

      Actual Results

      Jira uses the upgraded UPM but breaks the license cache,blocking UI usage and requiring a restart

      Workaround

      To immediately recover from the problem a restart is required but the problem can happen again (if a plugin is installed, license cleared, etc)

      To stop encountering the issue at the expense of NOT using an upgraded UPM release

      • Stop Jira
      • Remove any version of UPM from Jira-home/Shared-home /plugins/installed-plugins so that Jira keeps using its bundled release only
      • Start Jira

      Or remove the plugin and do a rolling restart in case of a multi-node installation

      Note
      This bug breaks the documentation Updating the Universal Plugin Manager since it's not advised to use a new release of UPM now.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              f0ea184c9b1c Mohamed Kouki
              Votes:
              12 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated: