Skip to content

fix: handle race condition on addUser#3952

Merged
strehle merged 3 commits into
cloudfoundry:developfrom
mikeroda:fix/addUser_race_condition
Jun 18, 2026
Merged

fix: handle race condition on addUser#3952
strehle merged 3 commits into
cloudfoundry:developfrom
mikeroda:fix/addUser_race_condition

Conversation

@mikeroda

Copy link
Copy Markdown
Contributor

No description provided.

fhanik
fhanik previously approved these changes Jun 18, 2026

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.

Pull request overview

This PR addresses a race condition during SCIM user bootstrap when a NewUserAuthenticatedEvent triggers user creation and a concurrent request inserts the same user first, by reconciling and optionally updating the existing user (based on the override flag).

Changes:

  • Catch ScimResourceAlreadyExistsException during user creation and reconcile by re-querying the concurrently-created user.
  • Refactor existing-user handling into a helper (handleRegisteringExistingUser) for reuse across normal and concurrent paths.
  • Add unit tests covering concurrent insert behavior for both override=true and override=false.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
server/src/main/java/org/cloudfoundry/identity/uaa/scim/bootstrap/ScimUserBootstrap.java Adds concurrent-create reconciliation logic and refactors existing-user handling; adjusts method visibility to enable test spying.
server/src/test/java/org/cloudfoundry/identity/uaa/scim/bootstrap/ScimUserBootstrapTests.java Adds tests that simulate concurrent insert behavior and verify update vs no-update based on override.

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@strehle strehle merged commit 305d619 into cloudfoundry:develop Jun 18, 2026
25 checks passed
@github-project-automation github-project-automation Bot moved this from Pending Merge | Prioritized to Done in Foundational Infrastructure Working Group Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants