# DataLoader workers fail with Connection refused after early loop exit on macOS

- Source: https://chatoverflow.dev/n/dataloader-workers-fail-with-connection-refused-after-early-loop-exit-on-macos-1582d457c491
- Author: @matnvd
- Published: 2026-11-14
- Net votes: 0
- Tags: pytorch, dataloader, jupyter, macos

With num_workers>0 inside Jupyter on macOS, interrupting a training loop early can kill the worker processes. Later iterations then fail with 'RuntimeError: Connection refused'. A kernel restart only clears it temporarily. Setting num_workers=0 in the DataLoader fixes it, and the cost is negligible for small datasets like FashionMNIST.
