Jira License/LicenseManager cache is not cleared when the add-ons are upgraded/disabled/enabled

We are marketplace vendors and we have discovered the following problem while testing the licensing checks we do in our add-ons.

We have:

  • Version A of our add-on, released on 2017-07-07
  • A commercial license with support expiring on 2017-08-26
  • Version B of our add-on, released on 2017-11-17

The problem. Test case:

  • install version A of the add-on
  • apply the commercial license: add-on works correctly <- OK
  • upgrade the add-on to the version B: add-on still works correctly <- NOK. The license maintenance expired before the release of version B, there should have been an error (LicenseError.VERSION_MISMATCH).

After investigation (on Jira 7.5 and latest UPM version), we’ve got to the conclusion that Jira caches the status of the licenses and does not clear this cache when add-ons are upgraded/disabled/enabled.

Like everybody else, we use the LicenseManager/License api to check the validity of the license. Our code is similar to:
final Option license = licenseManager.getLicense();
if (license.isDefined())
if (pluginLicense.isValid())
return OK;
… else error case, get error, etc

  • If we simply disable/enable the add-on, then the license works as if it was valid (cache not cleared, pluginLicense.isValid() returns true) and this is not ok.
  • If we restart the Jira instance, then Jira detects the invalid license and everything is handled correctly (meaning the add-on does not work anymore, pluginLicense.isValid() returns false).
  • Or, if in our add-on we do, during startup:
    eventPublisher.publish(new ClearCacheEvent(Collections.emptyMap()));
    all the caches are cleared and the add-on detects correctly that the license is invalid (pluginLicense.isValid() returns false).

The questions:

  • is this a bug and Atlassian should correct it?
  • do you invalidate all the caches during your add-on start-up to prevent this problem? (seems a bit extreme to me, even on a small dev instance it adds 10sec to the add-on start-up).
  • do you know any other method to invalidate only the licensing cache and to prevent this problem?

Thanks
Dan

1 Like

Well that’s going to be a really bad experience for the customer since when they restart the Jira instance later - they’ll get the versioning message (and at that point they won’t be aware of it).

I would suggest dropping in an Ecosystem Developer bug request at https://ecosystem.atlassian.net/servicedesk/customer/portal/14 so it can go through to the appropriate team at Atlassian.

1 Like

Hi Daniel,
Indeed, this could be pretty annoying and I think it affects all the server apps on the marketplace. I hoped someone had already found a solution to empty only the part of the cache storing licensing information.
I will probably report this issue as you have suggested. Thanks

I have reported this to Atlassian and a bug has been created: https://jira.atlassian.com/browse/JRASERVER-66647