code: def test_no_segfault():
      import multiprocessing
      import signal
  
      for method in ["fork", "spawn"]:
          # Repeat test a few times as garbage collection order failure is subject to race condition
          # and tended to exit properly once in a while
          for _ in range(2):
              for workers_num in range(1, 5):
                  mp = multiprocessing.get_context("spawn")
                  process = mp.Process(
                      target=_test_no_segfault,
                      args=(method, workers_num),
                  )
                  process.start()
                  process.join()
                  if process.exitcode != os.EX_OK:
                      if signal.SIGSEGV == -process.exitcode:
                          raise RuntimeError(
                              "Process terminated with signal SIGSEGV"
                          )
                      raise RuntimeError(
                          "Process exited with {} code".format(
                              process.exitcode
                          )
                      )
  
file_path: DALI/dali/test/python/test_external_source_parallel_garbage_collection_order.py
imports: import os
  import nvidia.dali.fn
  from nvidia.dali import pipeline_def
  from test_utils import get_dali_extra_path
  import numpy
label_desc: Use image node_id 4 for calling a global function with example usage: test_no_segfault() without return types