Skip to content

Multiprocessing: sharing a zero-sized tensor fails #5719

@colesbury

Description

@colesbury
  • PyTorch version: 0.4.0a0+c7611f7

Repro:

import torch
import torch.multiprocessing as mp

q = mp.Queue()
t = torch.tensor([])
q.put(t)

Result:

  File "/data/users/sgross/python3/lib/python3.5/multiprocessing/queues.py", line 241, in _feed
    obj = ForkingPickler.dumps(obj)
  File "/data/users/sgross/python3/lib/python3.5/multiprocessing/reduction.py", line 50, in dumps
    cls(buf, protocol).dump(obj)
  File "/data/users/sgross/pytorch/torch/multiprocessing/reductions.py", line 117, in reduce_storage
    df = multiprocessing.reduction.DupFd(fd)
  File "/data/users/sgross/python3/lib/python3.5/multiprocessing/reduction.py", line 190, in DupFd
    return resource_sharer.DupFd(fd)
  File "/data/users/sgross/python3/lib/python3.5/multiprocessing/resource_sharer.py", line 48, in __init__
    new_fd = os.dup(fd)
OSError: [Errno 9] Bad file descriptor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions