DeepSeek V4 Pro · 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 Opus 5.5.
- Gold bugs found
- 1 of 2
- Comments published
- 2
- Comments matching a bug
- 1
- Comments not matching
- 1
- Cost of this PR
- $0.251
Published comments (2)
mediumbugtests/base/src/test/java/org/keycloak/tests/admin/group/GroupTest.java:139-157
Reader thread is not joined before assertion — A reader exception raised after the deletion loop can be appended after the assertion, letting the test pass despite the NPE regression. Join the reader thread before calling `assertThat` so every `caughtExceptions` entry is visible.
mediumbugmodel/infinispan/src/main/java/org/keycloak/models/cache/infinispan/GroupAdapter.java:274-275
getSubGroupsCount returns null when group is concurrently deleted — A concurrent delete makes `getSubGroupsCount()` return null, violating the `GroupModel` contract and leaking null into `GroupRepresentation.subGroupCount`. Return `0L` for a missing model instead of null.
Gold bugs found (1)
mediumThe concurrency regression test never waits for the reader thread before asserting no exceptions, so it can pass even when the concurrent-deletion NPE still occurs.
Gold bugs missed (1)
mediumThe null guard for a concurrently deleted cached group is added only to getSubGroupsCount; the getSubGroupsStream overloads still dereference modelSupplier.get(), so e.g. GroupResource.getSubGroups still throws the NPE the PR set out to fix.