Kimi K3.1 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 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.432
Published comments (4)
getSubGroupsCount returns null when the delegate disappears — SPI consumers that unbox the result can get an NPE during concurrent deletion because `GroupModel.getSubGroupsCount()` has a non-null contract. Return `0L` when the delegate is gone, or filter vanished groups before populating counts.
The assertion can miss late reader failures in `caughtExceptions` — An in-flight request can fail after the assertion, letting the regression test pass despite a server error. Retain the reader thread, signal it to stop, and join it with a timeout before checking `caughtExceptions`.
Deletion failures leave the reader thread running indefinitely — A throwing group `remove()` skips `deletedAll.set(true)`, leaving the non-daemon reader running, potentially hanging the test JVM and growing the exception list. Wrap deletion in `try/finally` so the reader is always signaled to stop.
Reader thread may never issue a group request before deletion finishes — The reader may stay unscheduled until deletion sets `deletedAll`, exiting without calling `groups(...)` and letting the test pass without exercising concurrent reads. Add a latch or counter and wait for at least one reader request before starting deletion.
Gold bugs found (0)
None.
Gold bugs missed (0)
None.