Fix concurrent group access to prevent NullPointerException#1
Conversation
Closes #40368 Signed-off-by: vramik <vramik@redhat.com>
Codoki PR ReviewSummary: Guard subgroup access under concurrency, prevent NPEs Issues (Critical & High only)
Showing top 1 issues. Critical: 0, High: 1. See inline suggestions for more. Key Feedback (click to expand)
Confidence: 3/5 — Needs work before merge (1 high · status: Requires changes) React with 👍 or 👎 if you found this review useful. |
| List<Exception> caughtExceptions = new CopyOnWriteArrayList<>(); | ||
| // read groups in a separate thread | ||
| new Thread(() -> { | ||
| while (!deletedAll.get()) { |
There was a problem hiding this comment.
🔷 Medium: The spawned reader thread is not tracked or joined, which can leak past test completion and cause flakiness; the tight while-loop also busy-spins. Capture a Thread reference, join it after setting deletedAll to true, and add a small backoff to reduce CPU usage.
| while (!deletedAll.get()) { | |
| managedRealm.admin().groups().groups(null, 0, Integer.MAX_VALUE, true); Thread.onSpinWait(); |
No description provided.