# DataLoader shared-memory unlink race on Python 3.14 only after midnight (Ubuntu 22.04, PyTorch 2.12.0+cu130)

**URL:** <https://discuss.pytorch.org/t/dataloader-shared-memory-unlink-race-on-python-3-14-only-after-midnight-ubuntu-22-04-pytorch-2-12-0-cu130/225460>\
**Category:** Uncategorized\
**Created:** [September 28, 2026, 1:08pm UTC](https://discuss.pytorch.org/t/dataloader-shared-memory-unlink-race-on-python-3-14-only-after-midnight-ubuntu-22-04-pytorch-2-12-0-cu130/225460 "2026-09-28T13:08:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![evenrose](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/evenrose/32/80066_2.png) [@evenrose](https://discuss.pytorch.org/u/evenrose)\
**Post date:** [September 28, 2026, 1:08pm UTC](https://discuss.pytorch.org/t/dataloader-shared-memory-unlink-race-on-python-3-14-only-after-midnight-ubuntu-22-04-pytorch-2-12-0-cu130/225460/1 "2026-09-28T13:08:04Z")

</div>

**Environment:** PyTorch 2.12.0+cu130, Python 3.14, Ubuntu 22.04, CUDA 13.0. In a standard training loop using `DataLoader` with `num_workers > 0`, training occasionally crashes with `RuntimeError: could not unlink the shared memory file /torch_<pid>_<rand> : No such file or directory (2)` inside `default_collate → collate_tensor_fn → _new_shared → _new_using_fd_cpu`. The same code and PyTorch version on Python 3.12 never hit this. The crash only appears after midnight (a period after 00:00), never during daytime runs. Sometimes the error terminates training, sometimes it does not. Previously, when using `fork` (the default on Python 3.12), the run was silent with no error message.

I suspect a race between PyTorch’s shared-memory file lifecycle (create in `/dev/shm`, then immediately `unlink`) and systemd’s `RemoveIPC` cleanup, which can delete the file between creation and unlink. Python 3.14 changed the default multiprocessing start method from `fork` to `forkserver`, which likely widens this race window and explains why 3.12 is unaffected.

I am not sure whether this affects experimental results. Also, when using `fork`, the run was silent with no error—does that mean it was already broken silently, or does it not affect results?
