mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-21 15:57:38 +00:00
Extended probe worker drain
- Probe workers share a bounded 120-second settling deadline - Timeout failures include the unsettled pool state - Tests cover active work, deadline expiry, and interruption
This commit is contained in:
1 parent
2e3a41f262
commit
65894df632
2 files changed
+95
-2
No files matched your search
@@ -59,6 +59,7 @@ import java.util.concurrent.locks.LockSupport;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
final class RealPackProbeSupport {
|
||||
private static final long WORKER_DRAIN_TIMEOUT_NANOS = TimeUnit.SECONDS.toNanos(120);
|
||||
private static final List<Throwable> REPORTED = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
private RealPackProbeSupport() {
|
||||
@@ -157,7 +158,7 @@ final class RealPackProbeSupport {
|
||||
}
|
||||
|
||||
private static void awaitGenerationWorkers() throws InterruptedException {
|
||||
long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(15);
|
||||
long deadline = System.nanoTime() + WORKER_DRAIN_TIMEOUT_NANOS;
|
||||
List<ForkJoinPool> pools = new ArrayList<>(3);
|
||||
for (MultiBurst burst : List.of(MultiBurst.hydrology, MultiBurst.ioBurst, MultiBurst.burst)) {
|
||||
try {
|
||||
@@ -170,6 +171,10 @@ final class RealPackProbeSupport {
|
||||
throw new IllegalStateException("Probe generation worker barrier failed", failure);
|
||||
}
|
||||
}
|
||||
awaitGenerationWorkers(pools, deadline);
|
||||
}
|
||||
|
||||
static void awaitGenerationWorkers(List<ForkJoinPool> pools, long deadline) throws InterruptedException {
|
||||
long[] previous = quietWorkerSnapshot(pools, deadline);
|
||||
while (true) {
|
||||
long[] current = quietWorkerSnapshot(pools, deadline);
|
||||
@@ -189,7 +194,8 @@ final class RealPackProbeSupport {
|
||||
throw new InterruptedException("Probe generation worker barrier interrupted");
|
||||
}
|
||||
if (System.nanoTime() >= deadline) {
|
||||
throw new IllegalStateException("Probe generation workers did not settle within 15 seconds");
|
||||
throw new IllegalStateException("Probe generation workers did not settle before the deadline: pool "
|
||||
+ (index + 1) + "/" + pools.size() + " " + pool);
|
||||
}
|
||||
long count = pool.getStealCount();
|
||||
boolean quiet = pool.isQuiescent();
|
||||
|
||||
Reference in new issue
Block a user