Skip to content

Iterate a copy of the project map in JobsView.expandAllProjects - #496

Merged
Sheng Chen (jdneo) merged 2 commits into
microsoft:mainfrom
vogellacompany:jobs-view-expand-all-iteration
Oct 20, 2026
Merged

Sheng Chen (jdneo) merged 2 commits into
microsoft:mainfrom
vogellacompany:jobs-view-expand-all-iteration

Conversation

@vogella

Copy link
Copy Markdown
Contributor

JobsView.expandAllProjects iterated the key set of the synchronized repoToPullRequestsMap on the UI thread without holding the map's lock, while the refresh job clears it and the pull request searches fill it from worker threads. Clicking Expand All during a refresh could therefore throw ConcurrentModificationException and stop halfway. The loop now iterates a copy of the keys, which the synchronized map produces atomically, the same way the content provider already reads them.

expandAllProjects iterated the key set of a synchronized map on the UI thread without holding its lock, while the refresh job clears and fills the map from worker threads, which can throw ConcurrentModificationException and abort Expand All. It now iterates a snapshot of the keys.

Assisted-by: multiple AI agents and layers of automated tooling 🤖

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change prevents concurrent modification during iteration without altering expansion logic.

No open issues 🎉

What changed in this PR

Makes Expand All resilient to concurrent project-map updates in the Copilot Jobs view.

Changes:

  • Iterates a snapshot of project keys instead of the live key set.
  • Updates the comment to explain the concurrency safeguard.
File Description
com.microsoft.copilot.eclipse.ui.jobs/​src/​com/​microsoft/​copilot/​eclipse/​ui/​jobs/​views/​JobsView.java Snapshots project keys before expanding projects.

Review effort: Balanced

@jdneo Sheng Chen (jdneo) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!

@jdneo
Sheng Chen (jdneo) merged commit 6d2a7a7 into microsoft:main Oct 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants