code: def test_gcs_aio_client_reconnect(
      ray_start_regular_with_external_redis, auto_reconnect
  ):
      gcs_address = ray._private.worker.global_worker.gcs_client.address
      gcs_client = ray._raylet.GcsClient(address=gcs_address)
  
      gcs_client.internal_kv_put(b"a", b"b", True, None)
      assert gcs_client.internal_kv_get(b"a", None) == b"b"
  
      passed = [False]
  
      async def async_kv_get():
          if not auto_reconnect:
              with pytest.raises(Exception):
                  gcs_aio_client = gcs_utils.GcsAioClient(
                      address=gcs_address, nums_reconnect_retry=0
                  )
                  await gcs_aio_client.internal_kv_get(b"a", None)
          else:
              gcs_aio_client = gcs_utils.GcsAioClient(
                  address=gcs_address, nums_reconnect_retry=20
              )
              assert (
                  await gcs_aio_client.internal_kv_get(b"a", None)
                  == b"b"
              )
          return True
  
      def kv_get():
          import asyncio
  
          asyncio.set_event_loop(asyncio.new_event_loop())
          passed[0] = get_or_create_event_loop().run_until_complete(
              async_kv_get()
          )
  
      ray._private.worker._global_node.kill_gcs_server()
      t = threading.Thread(target=kv_get)
      t.start()
      sleep(5)
      ray._private.worker._global_node.start_gcs_server()
      t.join()
      assert passed[0]
  
imports: import sys
  import os
  import threading
  from time import sleep
  import pytest
  import ray
  from ray._private.utils import get_or_create_event_loop
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
  import ray._private.gcs_utils
  from ray._private import ray_constants
  from ray._private.test_utils import convert_actor_state, enable_external_redis, generate_system_config_map, wait_for_condition, wait_for_pid_to_exit, run_string_as_driver
  from ray.job_submission import JobSubmissionClient, JobStatus
  from ray._raylet import GcsClient
  import psutil
label_desc: Use image node_id 12 for calling a global function with example usage: test_gcs_aio_client_reconnect(ray_start_regular_with_external_redis, auto_reconnect) and returns: True