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