jenkinsci / lockable-resources-plugin

Lock resources against concurrent use
https://plugins.jenkins.io/lockable-resources
MIT License
87 stars 182 forks source link

Update to 1309.ve21874387edf claims "Unreadable Data": "CannotResolveClassException: lockedResources" #705

Open jimklimov opened 2 weeks ago

jimklimov commented 2 weeks ago

Jenkins and plugins versions report

Environment ```text Paste the output here ```

What Operating System are you using (both controller, and any agents involved in the problem)?

OpenIndiana, JDK21

Reproduction steps

Had LR installed since forever, regularly updated, many builds running and historic data retained.

Updated to current release 1309.ve21874387edf after 1301.v0e3b_da_4b_4462 installed a few days ago, and today I saw the "Unreadable Data" warnings. I think they were not present with the previous Jenkins uptime (it would take some time to wait until this instance is quiet to roll back the plugin and double-check), so if this really is a very new regression, gotta be fallout of PR #673 with a lot of wonderful changes, including renamed/removed API calls etc.

The lockedResources in question may be the list and count of resources used by a build and saved into its build.xml file (IIRC this feature got added during the past year or so?):

    <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction plugin="lockable-resources@1255.vf48745da_35d0">
      <lockedResources>
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-ResourcePOJO>
          <name>dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2480-15</name>
          <description></description>
          <count>224</count>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-ResourcePOJO>
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-ResourcePOJO>
          <name>gitcache-dynamatrix:ci-oi</name>
          <description></description>
          <count>15</count>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-ResourcePOJO>
...
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-ResourcePOJO>
          <name>gitcache-dynamatrix:ci-bsd</name>
          <description></description>
          <count>8</count>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-ResourcePOJO>
      </lockedResources>
    </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction>

In $BUILD_URL/locked-resources/ pages there is now a table which only displays "Loading - please wait ..." for older builds.

NOTE: Information is displayed for builds that happened after the update (more thoughts on this below). The new structure in build.xml indeed relies on different class logs to contain the differently structured entries:

    <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction plugin="lockable-resources@1309.ve21874387edf">
      <logs>
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
          <step>try</step>
          <action>Resource: dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2629-3</action>
          <resourceName>dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2629-3</resourceName>
          <timeStamp>1726647049346</timeStamp>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
          <step>acquired</step>
          <action>Resource: dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2629-3</action>
          <resourceName>dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2629-3</resourceName>
          <timeStamp>1726647049350</timeStamp>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
...
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
          <step>released</step>
          <action>Resource: dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2629-3</action>
          <resourceName>dynamatrix-stash:nut-ci-src:jenkins-nut-nut-PR-2629-3</resourceName>
          <timeStamp>1726695088424</timeStamp>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
        <org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
          <step>released</step>
          <action>Resource: gitcache-dynamatrix:fhnutci-bsd</action>
          <resourceName>gitcache-dynamatrix:fhnutci-bsd</resourceName>
          <timeStamp>1726695242740</timeStamp>
        </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction_-LogEntry>
      </logs>
      <resourcesInUse/>
    </org.jenkins.plugins.lockableresources.actions.LockedResourcesBuildAction>

Expected Results

Usage data should be still available to be seen. Maybe converted to a new structure if needed, as many plugins do to handle upgrades after large refactoring, but still usable.

UPDATE: Comparing the new build.xml logs to the old ones, I see the new ones auditing each operation like try to lock, acquired, released - yielding over 1500 detailed entries in the new build vs. 14 summaries in the old one (how many times a certain lock name was held). I think they both have different valuability for troubleshooting, optimization (what is a hot spot?) etc. so I'd rather add having such a summary page into the Expected Results bucket. Should not be hard to calculate the resulting Map from detailed audit info...

Actual Results

Warnings are issued. Data about resources used by an older build is not displayed.

Suspected PR #673 description does not seem to imply that such behavior change could be intentional.

Anything else?

No response

Are you interested in contributing a fix?

No response

jimklimov commented 2 weeks ago

For test, rolled back to LR 1301 on that Jenkins instance, now predictably new builds' info is "Unreadable data" (CannotResolveClassException: logs, CannotResolveClassException: resourcesInUse), but the old builds show their LR usage (summary) again.

So this pretty much proves PR #673 is responsible for this mishap as the only change between the two.

Maintenance-wise, good point in favor of making single-change releases to dissect the behavior changes easily :)