code: def test_controller_recover_initializing_actor(serve_instance):
      """Recover the actor which is under PENDING_INITIALIZATION"""
  
      signal = SignalActor.remote()
      signal2 = SignalActor.remote()
      client = serve_instance
  
      @ray.remote
      def pending_init_indicator():
          ray.get(signal2.wait.remote())
          return True
  
      @serve.deployment
      class V1:
          async def __init__(self):
              ray.get(signal2.send.remote())
              await signal.wait.remote()
  
          def __call__(self, request):
              return f"1|{os.getpid()}"
  
      serve.run(V1.bind(), _blocking=False, name="app")
      ray.get(pending_init_indicator.remote())
  
      def get_actor_info(name: str):
          all_current_actors = list_actors(
              filters=[("state", "=", "ALIVE")]
          )
          for actor in all_current_actors:
              if SERVE_PROXY_NAME in actor["name"]:
                  continue
              if name in actor["name"]:
                  print(actor)
                  return actor["name"], actor["pid"]
  
      actor_tag, _ = get_actor_info(f"app#{V1.name}")
      _, controller1_pid = get_actor_info(SERVE_CONTROLLER_NAME)
      ray.kill(
          serve.context._global_client._controller, no_restart=False
      )
      # wait for controller is alive again
      wait_for_condition(get_actor_info, name=SERVE_CONTROLLER_NAME)
      assert controller1_pid != get_actor_info(SERVE_CONTROLLER_NAME)[1]
  
      # Let the actor proceed initialization
      ray.get(signal.send.remote())
      client._wait_for_application_running("app")
      # Make sure the actor before controller dead is staying alive.
      assert actor_tag == get_actor_info(f"app#{V1.name}")[0]
  
imports: import asyncio
  import logging
  import os
  import re
  import sys
  import time
  from collections import defaultdict
  import pytest
  import requests
  import ray
  from ray import serve
  from ray._private.test_utils import SignalActor, wait_for_condition
  from ray.exceptions import RayTaskError
  from ray.serve._private.common import DeploymentID, ReplicaState
  from ray.serve._private.constants import SERVE_CONTROLLER_NAME, SERVE_DEFAULT_APP_NAME, SERVE_NAMESPACE, SERVE_PROXY_NAME
  from ray.serve._private.utils import get_random_string
  from ray.serve.schema import LoggingConfig
  from ray.serve.tests.test_failure import request_with_retries
  from ray.util.state import list_actors
label_desc: Use image node_id 3 for calling a global function with example usage: test_controller_recover_initializing_actor(serve_instance) and returns: True, str, os, actor,  actor