code: def test_recursively_nest_ids(
      one_worker_100MiB, use_ray_put, failure
  ):
      @ray.remote(max_retries=1)
      def recursive(ref, signal, max_depth, depth=0):
          unwrapped = ray.get(ref[0])
          if depth == max_depth:
              ray.get(signal.wait.remote())
              if failure:
                  os._exit(0)
              return
          else:
              return recursive.remote(
                  unwrapped, signal, max_depth, depth + 1
              )
  
      signal = SignalActor.remote()
  
      max_depth = 5
      array_oid = put_object(
          np.zeros(20 * 1024 * 1024, dtype=np.uint8), use_ray_put
      )
      nested_oid = array_oid
      for _ in range(max_depth):
          nested_oid = ray.put([nested_oid])
      head_oid = recursive.remote([nested_oid], signal, max_depth)
  
      # Remove the local reference.
      array_oid_bytes = array_oid.binary()
      del array_oid, nested_oid
  
      tail_oid = head_oid
      for _ in range(max_depth):
          tail_oid = ray.get(tail_oid)
  
      # Check that the remote reference pins the object.
      _fill_object_store_and_get(array_oid_bytes)
  
      # Fulfill the dependency, causing the tail task to finish.
      ray.get(signal.send.remote())
      if not failure:
          ray.get(tail_oid)
      else:
          # There is only 1 core, so the same worker will execute all `recursive`
          # tasks. Therefore, if we kill the worker during the last task, its
          # owner (the worker that executed the second-to-last task) will also
          # have died.
          with pytest.raises(ray.exceptions.OwnerDiedError):
              ray.get(tail_oid)
  
      # Reference should be gone, check that array gets evicted.
      _fill_object_store_and_get(array_oid_bytes, succeed=False)
  
imports: import logging
  import os
  import copy
  import platform
  import random
  import signal
  import sys
  import time
  import numpy
  import pytest
  import ray
  import ray.cluster_utils
  from ray._private.internal_api import memory_summary
  from ray._private.test_utils import SignalActor, put_object, wait_for_condition, wait_for_num_actors
  import ray._private.gcs_utils
label_desc: Use image node_id 3 for calling a global function with example usage: test_recursively_nest_ids(one_worker_100MiB, use_ray_put, failure) and returns: recursive