jenkinsci / lockable-resources-plugin

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

More concurrent modification exception avoidance #610

Closed jimklimov closed 9 months ago

jimklimov commented 9 months ago

See #604, #601 and similar efforts.

This PR adds synchronization for operations done with LRM resources property, because during a Jenkins start with recent plugin version I've still occasionally got that ConcurrentModificationException. My best guess is that freePostMortemResources() (explicitly mentioned in the starting page stack trace) and perhaps deleteNotExistingNodes() locked horns.

The XML mentioned a number of resources, all are ephemeral=true (probably saved with a graceful shutdown, then slated for deletion during start-up as no living jobs referenced them). On that system, there are no lockable resources defined persistently.

Testing done

Deployed into the Jenkins instance that suffered the issue. It started and seems to work correctly (gotta run some builds that lock/unlock stuff, to be more sure), and cleaned away many of the ephemeral resources.

On one restart I saw two remaining (one claimed locked by a job that was aborted by the restart), on another one remained and did not disappear after I claimed and released it via UI.

Proposed upgrade guidelines

N/A

Localizations

Submitter checklist