Random torch "RuntimeError: Connection refused" happened on Github Actions with macos

We are working on this reinforcement learning project here and we used GitHub Actions to build our testing CI system. Basically, we run unit tests with GitHub Actions on linux and macos. We find that the error below randomly occurs on macos.(It can pass when we rerun the job manually.) We cannot reproduce the error on our local machine. The corresponding unit test is here

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/miniconda/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/usr/local/miniconda/lib/python3.9/multiprocessing/spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
  File "/usr/local/miniconda/lib/python3.9/site-packages/torch/multiprocessing/reductions.py", line 322, in rebuild_storage_filename
    storage = torch.UntypedStorage._new_shared_filename_cpu(manager, handle, size)
RuntimeError: Connection refused

I’d like to know: 1. Has someone encountered this before? 2. Is this caused by our side or the GitHub Actions side? 2. If it is caused by our side, how can we debug it(since GitHub Actions is a black box to us and we cannot reproduce it locally)? 3. If it is caused by the GitHub Actions side, is there an elegant way to deal with it?