code: def test_actor_holding_serialized_reference(
      one_worker_100MiB, use_ray_put, failure
  ):
      @ray.remote
      class GreedyActor(object):
          def __init__(self):
              pass
  
          def set_ref1(self, ref):
              self.ref1 = ref
  
          def add_ref2(self, new_ref):
              self.ref2 = new_ref
  
          def delete_ref1(self):
              self.ref1 = None
  
          def delete_ref2(self):
              self.ref2 = None
  
      # Test that the reference held by the actor isn't evicted.
      array_oid = put_object(
          np.zeros(20 * 1024 * 1024, dtype=np.uint8), use_ray_put
      )
      actor = GreedyActor.remote()
      actor.set_ref1.remote([array_oid])
  
      # Test that giving the same actor a duplicate reference works.
      ray.get(actor.add_ref2.remote([array_oid]))
  
      # Remove the local reference.
      array_oid_bytes = array_oid.binary()
      del array_oid
  
      # Test that the remote references still pin the object.
      _fill_object_store_and_get(array_oid_bytes)
  
      # Test that removing only the first reference doesn't unpin the object.
      ray.get(actor.delete_ref1.remote())
      _fill_object_store_and_get(array_oid_bytes)
  
      if failure:
          # Test that the actor exiting stops the reference from being pinned.
          # Kill the actor and wait for the actor to exit.
          kill_actor_and_wait_for_failure(actor)
          with pytest.raises(ray.exceptions.RayActorError):
              ray.get(actor.delete_ref1.remote())
      else:
          # Test that deleting the second reference stops it from being pinned.
          ray.get(actor.delete_ref2.remote())
      _fill_object_store_and_get(array_oid_bytes, succeed=False)
  
imports: import copy
  import logging
  import os
  import sys
  import time
  import numpy
  import pytest
  import ray
  import ray._private.gcs_utils
  import ray.cluster_utils
  from ray._private.test_utils import SignalActor, convert_actor_state, kill_actor_and_wait_for_failure, put_object, wait_for_condition, skip_flaky_core_test_premerge
label_desc: Use image node_id 14 for calling a global function with example usage: test_actor_holding_serialized_reference(one_worker_100MiB, use_ray_put, failure) without return types