pytorch
system_error
ai_generated
partial
运行时错误:数据加载器工作进程(pid 12345)意外退出:总线错误(核心已转储)
RuntimeError: DataLoader worker (pid 12345) exited unexpectedly: Bus error (core dumped)
ID: pytorch/dataloader-worker-exit-with-bus-error
78%修复率
83%置信度
1证据数
2024-02-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| torch>=1.12.0 | active | — | — | — |
| cuda>=11.0 | active | — | — | — |
| python>=3.8 | active | — | — | — |
根因分析
数据加载器工作进程因共享内存损坏或对齐问题遇到总线错误,通常由共享内存中不兼容对齐的大张量引起。
English
DataLoader worker process encountered a bus error due to shared memory corruption or misalignment, often caused by large tensors in shared memory with incompatible alignment.
官方文档
https://pytorch.org/docs/stable/data.html#multi-process-data-loading解决方案
-
Set multiprocessing start method to 'spawn' instead of 'fork' to avoid shared memory corruption.
-
Reduce DataLoader batch size or use prefetch_factor=2 to limit shared memory usage.
无效尝试
常见但无效的做法:
-
Increasing the number of workers in DataLoader
90% 失败
More workers increase contention for shared memory and can exacerbate the bus error.
-
Setting pin_memory=False in DataLoader
80% 失败
Bus errors are not primarily caused by pin_memory; disabling it may not address the underlying memory alignment issue.