Skip to content

Prevent LDAP group sync from looping forever when batch size is zero - #55635

Open
Thufayl wants to merge 1 commit into
keycloak:mainfrom
Thufayl:fix/55311-ldap-batchsize-zero
Open

Thufayl wants to merge 1 commit into
keycloak:mainfrom
Thufayl:fix/55311-ldap-batchsize-zero

Conversation

@Thufayl

@Thufayl Thufayl commented Nov 27, 2026

Copy link
Copy Markdown

Closes #55311

A non-positive batch size for sync is treated as unset and falls back to the default, fixing it centrally for all sync paths rather than only the reported group sync.

Developed with AI assistance.

A configured batch size for sync of 0 or less made the per-transaction loop never advance its iterator. Treat a non-positive value as unset and fall back to the default batch size.

Closes keycloak#55311

Signed-off-by: Thufayl <muhammedthufayl@gmail.com>
@Thufayl
Thufayl marked this pull request as ready for review November 27, 2026 17:04
@Thufayl
Thufayl requested a review from a team as a code owner November 27, 2026 17:04
Copilot AI balanced review requested due to automatic review settings November 27, 2026 17:04

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

No active review issues are reported for the centralized LDAP batch-size fallback change.

No open issues 🎉

What changed in this PR

Addresses #55311 by handling non-positive batch sizes centrally in LDAP configuration, preventing group synchronization from looping indefinitely and applying the same fallback across LDAP sync paths.

Changes:

  • Use the default sync batch size when the configured value is zero or negative, while preserving positive values.
  • Add unit tests for zero, negative, unset, and positive batch sizes.
File Description
federation/​ldap/​src/​test/​java/​org/​keycloak/​storage/​ldap/​LDAPConfigTest.java Adds tests for batch-size fallback and preservation of positive values.
federation/​ldap/​src/​main/​java/​org/​keycloak/​storage/​ldap/​LDAPConfig.java Falls back to the default batch size for non-positive values.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LDAP group synchronization hangs indefinitely when Batch Size for Sync is set to 0

2 participants