DeepSeek V4.1 Flash · Balanced

fix-concurrent-group-access-to-prevent-nullpointerexception-keycloak

Keycloak · Java · XS · <30 lines · 3 files

The normal review, with one generalist agent. Judge: Claude Haiku 5.5.

Gold bugs found
0 of 0
Comments published
4
Comments matching a bug
0
Comments not matching
4
Cost of this PR
$0.075

Published comments (4)

mediumbugmodel/infinispan/src/main/java/org/keycloak/models/cache/infinispan/GroupAdapter.java:274-275

getSubGroupsCount returns null for deleted group, violating SPI contract — Consumers that unbox or aggregate the count now throw an NPE on a concurrently deleted group, moving the crash to a harder-to-diagnose layer. Return a non-null value such as `0L`, or re-resolve through the delegate and signal a controlled failure.

mediumbugtests/base/src/test/java/org/keycloak/tests/admin/group/GroupTest.java:139-155

Reader thread can hang test JVM if group deletion throws — Any exception from `group(groupUuid).remove()` leaves the non-daemon reader thread spinning forever and hangs the whole test JVM. Wrap the deletion loop in `try/finally` that always sets `deletedAll`, and preferably make the thread a daemon.

mediumbugtests/base/src/test/java/org/keycloak/tests/admin/group/GroupTest.java:155-157

Reader thread not joined before asserting caught exceptions — A failure from an in-flight `groups()` request is appended after the assertion already passed, so the regression this test targets can be missed. Join the reader thread before checking `caughtExceptions`.

mediumperformancetests/base/src/test/java/org/keycloak/tests/admin/group/GroupTest.java:139-149

Reader thread busy-spins on full group listings and unbounded errors — The unbounded `caughtExceptions` list and full-hierarchy reads on every iteration can saturate CPU or fail with OOM instead of reporting the assertion. Add a small delay and record only the first failure.

Gold bugs found (0)

None.

Gold bugs missed (0)

None.