DeepSeek V4 Pro · Heavy

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

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

The generalist plus 9 specialist lens agents in parallel, then the same verify and dedup steps. 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.504

Published comments (2)

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

Return 0L instead of null when delegate model is missing in getSubGroupsCount — Returning `null` here breaks the `GroupModel` contract that this method 'Never returns null', and `GroupUtils.populateSubGroupCount` forwards that null into the REST response. Return `0L` when `model` is null.

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

Reader thread is never joined before asserting caughtExceptions — The assertion can pass before the reader thread finishes its last in-flight request, hiding exceptions that occur after the check. Join `reader` before asserting on `caughtExceptions` so the concurrent-deletion behavior is fully observed.

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.