Repository: pytorch
Issue: MaybeEncodingError: Error sending result
Labels: module: multiprocessing,module: dataloader,triaged

### 🐛 Describe the bug

Exception has occurred: MaybeEncodingError
Error sending result: '[[(<networkx.classes.digraph.DiGraph object at 0x7fcc19a5ae20>, <networkx.classes.digraph.DiGraph object at 0x7fcc19a5b5e0>), ..., (<networkx.classes.digraph.DiGraph object at 0x7fcc183ce640>, <networkx.classes.digraph.DiGraph object at 0x7fcc183ce790>)]]'. 
Reason: 'RuntimeError('falseINTERNAL ASSERT FAILED at "/opt/conda/conda-bld/pytorch_1640811803361/work/aten/src/ATen/MapAllocator.cpp":263, please report a bug to PyTorch. unable to open shared memory object </torch_12961_4087> in read-write mode')'
```
    pool = Pool(args.ncpu) # increases speed significantly # TODO [FEATURE] multi-cpu; use pool
    partialized_function = partial(process, show_progress=False)
    vocab_lists = pool.map(partialized_function, load_paths_batches)

    def process(data, show_progress=False):
        vocab = []
        for index, load_path in enumerate(data):
            // create graph-tuples
            vocab.extend(graph_tuples)
        return vocab
```

Might be a duplicate of https://github.com/pytorch/pytorch/issues/67992
But it seemed like you need some more data to properly analyse the problem.
I can't share my training data, but i can share my code.

### To Reproduce

Basically I created a lot of tuples containing two networkx.DiGraphs. The graphs were converted from DGL. 
DGL automatically tensorizes all node-attributes. In my method i removed the tensors for all attributes. 
The the resulting DiGraphs are tensor-free and don't contain any pytorch-references.

The pooling works fine for a small amount of data. But in this case i created about 2800 graphs.
Previously I got a buffer-overflow exception during the pooling, but this one myteriously disappeared.

### Expected behavior

It should be working on big amount of data too.



### Versions

Collecting environment information...
PyTorch version: 1.10.2
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.10.2
Libc version: glibc-2.27

Python version: 3.9.7 (default, Sep 16 2021, 13:09:58)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-5.4.0-99-generic-x86_64-with-glibc2.27
Is CUDA available: True
CUDA runtime version: 9.1.85
GPU models and configuration: GPU 0: NVIDIA GeForce GTX 1650
Nvidia driver version: 470.103.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.21.2
[pip3] torch==1.10.2
[pip3] torchaudio==0.10.2
[pip3] torchvision==0.11.3
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               11.3.1               h2bc3f7f_2  
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.21.2           py39h20f2e39_0  
[conda] numpy-base                1.21.2           py39h79a1101_0  
[conda] pytorch                   1.10.2          py3.9_cuda11.3_cudnn8.2.0_0    pytorch
[conda] pytorch-mutex             1.0                        cuda    pytorch
[conda] torchaudio                0.10.2               py39_cu113    pytorch
[conda] torchvision               0.11.3               py39_cu113    pytorch

cc @VitalyFedyunin @SsnL @ejguan @NivekT