Skip to content

Do not loop forever on LDAP group sync when the batch size for sync is 0 - #55631

Open
tkyjovsk wants to merge 2 commits into
keycloak:mainfrom
tkyjovsk:55311
Open

tkyjovsk wants to merge 2 commits into
keycloak:mainfrom
tkyjovsk:55311

Conversation

@tkyjovsk

Copy link
Copy Markdown
Contributor

Closes #55311.

The original PR #55334 seems to have been removed and the profile of the original submitter seems to be blocked by GH, so I'm creating a new PR. It includes the original author's commit plus a fix for its test case.

Dezhen Lu and others added 2 commits November 27, 2026 15:44
A batch size of 0 or less now imports the flat group structure in one transaction, as the groups are already loaded without paging in that case.

Closes keycloak#55311

Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
…ithBatchSizeZero` to correctly catch issue keycloak#55311.

Signed-off-by: Tomas Kyjovsky <tkyjovsk@ibm.com>
@tkyjovsk
tkyjovsk marked this pull request as ready for review November 27, 2026 15:54
@tkyjovsk
tkyjovsk requested review from a team as code owners November 27, 2026 15:54
Copilot AI balanced review requested due to automatic review settings November 27, 2026 15:54

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 change addressing LDAP flat-group synchronization hangs with nonpositive batch sizes.

No open issues 🎉

What changed in this PR

Fixes the LDAP flat-group synchronization hang described in #55311 by treating nonpositive batch sizes as unbatched processing, consistent with LDAP retrieval.

Changes:

  • Ensures synchronization advances when the configured batch size is zero or negative.
  • Adds a zero-batch regression test that checks all three groups are imported without nesting and asserts completion within five seconds.
File Description
testsuite/​integration-arquillian/​tests/​base/​src/​test/​java/​org/​keycloak/​testsuite/​federation/​ldap/​LDAPGroupMapperSyncTest.java Adds timeout-based coverage for zero-batch flat-group synchronization.
federation/​ldap/​src/​main/​java/​org/​keycloak/​storage/​ldap/​mappers/​membership/​group/​GroupLDAPStorageMapper.java Uses an effectively unlimited batch for nonpositive values to prevent the infinite loop.

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