CoordinatedShutdown with reason - How to disable it?

Hi, as I’m building on GRPC Gatling Test by following phiSgr example, I encounter an error as this

10:21:01.047 [pool-1-thread-1] INFO io.gatling.core.config.GatlingConfiguration$ - Gatling will try to load 'gatling.conf' config file as ClassLoader resource.
10:21:01.522 [GatlingSystem-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
10:21:01.767 [pool-1-thread-1] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
10:21:01.880 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
10:21:01.880 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - Java version: 17
10:21:01.882 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
10:21:01.882 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
10:21:01.883 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.storeFence: available
10:21:01.883 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
10:21:01.883 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable: Reflective setAccessible(true) disabled
10:21:01.884 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
10:21:01.885 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: class io.netty.util.internal.PlatformDependent0$7 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @57a49ead
10:21:01.886 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): unavailable
10:21:01.886 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
10:21:01.902 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - maxDirectMemory: 1073741824 bytes (maybe)
10:21:01.902 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\<user>\AppData\Local\Temp (java.io.tmpdir)
10:21:01.902 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
10:21:01.902 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - Platform: Windows
10:21:01.903 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
10:21:01.903 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
10:21:01.904 [pool-1-thread-1] DEBUG io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
10:21:01.904 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
10:21:01.914 [pool-1-thread-1] DEBUG io.netty.channel.MultithreadEventLoopGroup - -Dio.netty.eventLoopThreads: 8
10:21:01.922 [pool-1-thread-1] DEBUG io.netty.util.concurrent.GlobalEventExecutor - -Dio.netty.globalEventExecutor.quietPeriodSeconds: 1
10:21:01.930 [pool-1-thread-1] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.initialSize: 1024
10:21:01.930 [pool-1-thread-1] DEBUG io.netty.util.internal.InternalThreadLocalMap - -Dio.netty.threadLocalMap.stringBuilder.maxSize: 4096
10:21:01.934 [pool-1-thread-1] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.noKeySetOptimization: false
10:21:01.935 [pool-1-thread-1] DEBUG io.netty.channel.nio.NioEventLoop - -Dio.netty.selectorAutoRebuildThreshold: 512
10:21:01.947 [pool-1-thread-1] DEBUG io.netty.util.internal.PlatformDependent - org.jctools-core.MpscChunkedArrayQueue: available
10:21:03.210 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
10:21:03.211 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - -Dio.netty.noUnsafe: false
10:21:03.211 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - Java version: 17
10:21:03.211 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.theUnsafe: available
10:21:03.213 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.copyMemory: available
10:21:03.213 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - sun.misc.Unsafe.storeFence: available
10:21:03.213 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.Buffer.address: available
10:21:03.213 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - direct buffer constructor: unavailable: Reflective setAccessible(true) disabled
10:21:03.213 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.Bits.unaligned: available, true
10:21:03.214 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: class io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0$7 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @57a49ead
10:21:03.215 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent0 - java.nio.DirectByteBuffer.<init>(long, int): unavailable
10:21:03.215 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - sun.misc.Unsafe: available
10:21:03.215 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - maxDirectMemory: 1073741824 bytes (maybe)
10:21:03.216 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.tmpdir: C:\Users\<user>\AppData\Local\Temp (java.io.tmpdir)
10:21:03.216 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.bitMode: 64 (sun.arch.data.model)
10:21:03.216 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - Platform: Windows
10:21:03.216 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.maxDirectMemory: -1 bytes
10:21:03.216 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.uninitializedArrayAllocationThreshold: -1
10:21:03.217 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.CleanerJava9 - java.nio.ByteBuffer.cleaner(): available
10:21:03.217 [pool-1-thread-1] DEBUG io.grpc.netty.shaded.io.netty.util.internal.PlatformDependent - -Dio.netty.noPreferDirect: false
10:21:03.507 [pool-1-thread-1]
ERROR io.gatling.app.Gatling$ - Run crashed
java.lang.reflect.InvocationTargetException: null
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at io.gatling.app.SimulationClass$Scala.params(SimulationClass.scala:31)
        at io.gatling.app.Runner.load(Runner.scala:72)
        at io.gatling.app.Runner.run(Runner.scala:57)
        at io.gatling.app.Gatling$.start(Gatling.scala:89)
        at io.gatling.app.Gatling$.fromArgs(Gatling.scala:51)
        at io.gatling.app.Gatling$.fromSbtTestFramework(Gatling.scala:47)
        at io.gatling.sbt.GatlingTask.liftedTree1$1(GatlingTask.scala:51)
        at io.gatling.sbt.GatlingTask.execute(GatlingTask.scala:50)
        at sbt.ForkMain$Run.lambda$runTest$1(ForkMain.java:414)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.AssertionError: assertion failed
        at scala.Predef$.assert(Predef.scala:264)
        at com.github.phisgr.gatling.grpc.request.Unary.<init>(builders.scala:27)
        at com.github.phisgr.gatling.grpc.request.Grpc.rpc(builders.scala:14)
        at test.scala.BasicSimu.<init>(BasicSimu.scala:39)
        ... 18 common frames omitted
10:21:03.580 [GatlingSystem-akka.actor.default-dispatcher-5] INFO akka.actor.CoordinatedShutdown - Running CoordinatedShutdown with reason [ActorSystemTerminateReason]
[error] java.lang.reflect.InvocationTargetException
[error]         at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error]         at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
[error]         at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error]         at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
[error]         at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
[error]         at io.gatling.app.SimulationClass$Scala.params(SimulationClass.scala:31)
[error]         at io.gatling.app.Runner.load(Runner.scala:72)
[error]         at io.gatling.app.Runner.run(Runner.scala:57)
[error]         at io.gatling.app.Gatling$.start(Gatling.scala:89)
[error]         at io.gatling.app.Gatling$.fromArgs(Gatling.scala:51)
[error]         at io.gatling.app.Gatling$.fromSbtTestFramework(Gatling.scala:47)
[error]         at io.gatling.sbt.GatlingTask.liftedTree1$1(GatlingTask.scala:51)
[error]         at io.gatling.sbt.GatlingTask.execute(GatlingTask.scala:50)
[error]         at sbt.ForkMain$Run.lambda$runTest$1(ForkMain.java:414)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error]         at java.base/java.lang.Thread.run(Thread.java:833)
[error] Caused by: java.lang.AssertionError: assertion failed
[error]         at scala.Predef$.assert(Predef.scala:264)
[error]         at com.github.phisgr.gatling.grpc.request.Unary.<init>(builders.scala:27)
[error]         at com.github.phisgr.gatling.grpc.request.Grpc.rpc(builders.scala:14)
[error]         at test.scala.BasicSimu.<init>(BasicSimu.scala:39)
[error]         ... 18 more
[error] Simulation BasicSimu failed.
[info] Simulation(s) execution ended.
[error] Failed tests:
[error]         test.scala.BasicSimu

I’m not quite sure how this happened, but here is the chunk of code that I implemented:

val grpcConf = grpc(managedChannelBuilder(name = "the-link", port = 80)
                .usePlaintext())
                .header(util.BearerToken, optional = true)($(TokenKey))
  val scn = scenario("BasicSimulation")
      .exec(
        grpc("test")
          .rpc(RelayServerGrpc.METHOD_START_PAIRING)
          .payload(StartPairingRequest(Option(Device("labore non laborum id ea"))))
          .check(statusCode is Status.Code.OK)
          )

Can someone explain me the error ?

Should be when some code called system.terminate() on the ActorSystem. If you are unsure where/why but can reproduce easiest could be attaching a debugger and put a breakpoint in ActorSystemImpl.terminate and look at the stack when the debugger hits that breakpoint.

hi @johanandren , thanks for your suggestion, since I’m new to sbt and scala, I’m not familiar with the debuggers, could you help to provide some instructions so that I could follow up ?

And also, thank you all for making the akka-grpc.

Nothing much different than debugging Java in general, your IDE can probably set breakpoints and talk to the debugger. The tricky part can be running the application, which doesn’t always work as expected from inside an IDE and might instead need to be done through sbt.

When starting through sbt the application will either run in the same JVM as sbt or “forked” in a separate JVM process. If it is in the same process you can pass agent options when you start sbt via -J-agentlib..., if it is forked, you can pass it through the sbt setting javaOptions.

With IntelliJ that is called “remote” debugging, you can read about that and how to get the agent lib parameter for the JVM in their docs: Tutorial: Remote debug | IntelliJ IDEA Documentation