Crash Bazel if NetworkTime failed to stop.

PiperOrigin-RevId: 342576866
diff --git a/src/main/java/com/google/devtools/build/lib/remote/util/NetworkTime.java b/src/main/java/com/google/devtools/build/lib/remote/util/NetworkTime.java
index fa331a2b..52e11ed 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/util/NetworkTime.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/util/NetworkTime.java
@@ -14,8 +14,8 @@
 package com.google.devtools.build.lib.remote.util;
 
 import build.bazel.remote.execution.v2.ExecutionGrpc;
+import com.google.common.base.MoreObjects;
 import com.google.common.base.Stopwatch;
-import com.google.common.flogger.GoogleLogger;
 import com.google.devtools.build.lib.concurrent.ThreadSafety;
 import io.grpc.CallOptions;
 import io.grpc.Channel;
@@ -32,7 +32,6 @@
 /** Reentrant wall clock stopwatch and grpc interceptor for network waits. */
 @ThreadSafety.ThreadSafe
 public class NetworkTime {
-  private static final GoogleLogger logger = GoogleLogger.forEnclosingClass();
 
   public static final Context.Key<NetworkTime> CONTEXT_KEY = Context.key("remote-network-time");
 
@@ -56,6 +55,15 @@
     return wallTime.elapsed();
   }
 
+  @Override
+  public String toString() {
+    return MoreObjects.toStringHelper(this)
+        .add("outstanding", outstanding)
+        .add("wallTime", wallTime)
+        .add("wallTime.isRunning", wallTime.isRunning())
+        .toString();
+  }
+
   /** The ClientInterceptor used to track network time. */
   public static class Interceptor implements ClientInterceptor {
     @Override
@@ -92,13 +100,13 @@
 
             @Override
             public void onClose(Status status, Metadata trailers) {
-              // There is a risk that networkTime.stop() would throw a IllegalStateException: if
-              // networkTime.outstanding is overflowed, wallTime.stop() will be called even it's
-              // already stopped.
               try {
                 networkTime.stop();
               } catch (RuntimeException e) {
-                logger.atWarning().withCause(e).log("Failed to stop networkTime");
+                // An unchecked exception means we have bugs in the above try block, force crash
+                // Bazel so we can have a chance to look into.
+                throw new AssertionError(
+                    "networkTime.stop() must not throw unchecked exception: " + networkTime, e);
               } finally {
                 // Make sure to call super.onClose, otherwise gRPC will silently hang indefinitely.
                 // See https://github.com/grpc/grpc-java/pull/6107.