This is due to a race condition in the ShutdownBehavior test where the second server thread may actually acquire and update the firstRun atomic before the first server thread, causing the first server thread to fail the ASSERT_NOT_OK(ping.getStatus()) check, and therefore not be properly cleaned up by the reactor leading to the invariant failure.
See this comment on BF-39873 for details and reproduction.