Repository: pytorch
Issue: batch_sampler/test_worker_seed intermittently fails with address already in use on OS X
Labels: todo,module: serialization,triaged,module: flaky-tests

Sample log:

```
19:26:36 test_add_dataset (__main__.TestConcatDataset) ... ok
19:26:36 test_concat_raises_index_error (__main__.TestConcatDataset) ... ok
19:26:36 test_concat_two_non_singletons (__main__.TestConcatDataset) ... ok
19:26:36 test_concat_two_non_singletons_with_empty (__main__.TestConcatDataset) ... ok
19:26:36 test_concat_two_singletons (__main__.TestConcatDataset) ... ok
19:26:36 test_batch_sampler (__main__.TestDataLoader) ... libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: Address already in use
19:26:36 ERROR
19:26:36 test_default_colate_bad_numpy_types (__main__.TestDataLoader) ... ok
19:26:36 test_error (__main__.TestDataLoader) ... ok
19:26:36 test_error_workers (__main__.TestDataLoader) ... ok
19:26:36 test_growing_dataset (__main__.TestDataLoader) ... ok
19:26:36 test_invalid_assign_after_init (__main__.TestDataLoader) ... ok
19:26:36 test_len (__main__.TestDataLoader) ... ok
19:26:36 test_manager_unclean_exit (__main__.TestDataLoader)
19:26:36 there might be ConnectionResetError or leaked semaphore warning (due to dirty process exit), but they are all safe to ignore ... skipped 'CUDA unavailable'
19:26:36 test_multiple_dataloaders (__main__.TestDataLoader) ... ok
19:26:36 test_numpy (__main__.TestDataLoader) ... ok
19:26:36 test_numpy_scalars (__main__.TestDataLoader) ... ok
19:26:36 test_partial_workers (__main__.TestDataLoader)
19:26:36 check that workers exit even if the iterator is not exhausted ... skipped 'CUDA unavailable'
19:26:36 test_segfault (__main__.TestDataLoader) ... skipped 'temporarily disable until flaky failures are fixed'
19:26:36 test_seqential_batch_workers (__main__.TestDataLoader) ... ok
19:26:36 test_sequential (__main__.TestDataLoader) ... ok
19:26:36 test_sequential_batch (__main__.TestDataLoader) ... ok
19:26:36 test_sequential_pin_memory (__main__.TestDataLoader) ... skipped 'CUDA unavailable'
19:26:36 test_sequential_workers (__main__.TestDataLoader) ... ok
19:26:36 test_shuffle (__main__.TestDataLoader) ... ok
19:26:36 test_shuffle_batch (__main__.TestDataLoader) ... ok
19:26:37 test_shuffle_batch_workers (__main__.TestDataLoader) ... ok
19:26:37 test_shuffle_pin_memory (__main__.TestDataLoader) ... skipped 'CUDA unavailable'
19:26:37 test_shuffle_workers (__main__.TestDataLoader) ... ok
19:26:37 test_timeout (__main__.TestDataLoader) ... ok
19:26:38 test_worker_init_fn (__main__.TestDataLoader) ... ok
19:26:38 test_worker_seed (__main__.TestDataLoader) ... ok
19:26:38 test_lengths_must_equal_datset_size (__main__.TestDatasetRandomSplit) ... ok
19:26:38 test_splits_are_mutually_exclusive (__main__.TestDatasetRandomSplit) ... ok
19:26:38 test_splits_have_correct_size (__main__.TestDatasetRandomSplit) ... ok
19:26:38 test_pin_memory (__main__.TestDictDataLoader) ... skipped 'CUDA unavailable'
19:26:38 test_sequential_batch (__main__.TestDictDataLoader) ... ok
19:26:38 test_ind_worker_queue (__main__.TestIndividualWorkerQueue) ... ok
19:26:39 test_shuffle_pin_memory (__main__.TestStringDataLoader) ... skipped 'CUDA unavailable'
19:26:39 test_getitem (__main__.TestTensorDataset) ... ok
19:26:39 test_getitem_1d (__main__.TestTensorDataset) ... ok
19:26:39 test_len (__main__.TestTensorDataset) ... ok
19:26:39 test_many_tensors (__main__.TestTensorDataset) ... ok
19:26:39 test_single_tensor (__main__.TestTensorDataset) ... ok
19:26:39 
19:26:39 ======================================================================
19:26:39 ERROR: test_batch_sampler (__main__.TestDataLoader)
19:26:39 ----------------------------------------------------------------------
19:26:39 Traceback (most recent call last):
19:26:39   File "test_dataloader.py", line 441, in test_batch_sampler
19:26:39     self._test_batch_sampler(num_workers=4)
19:26:39   File "test_dataloader.py", line 427, in _test_batch_sampler
19:26:39     for i, (input, _target) in enumerate(dl):
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 336, in __next__
19:26:39     return self._process_next_batch(batch)
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 357, in _process_next_batch
19:26:39     raise batch.exc_type(batch.exc_msg)
19:26:39 RuntimeError: Traceback (most recent call last):
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop
19:26:39     samples = collate_fn([dataset[i] for i in batch_indices])
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 187, in default_collate
19:26:39     return [default_collate(samples) for samples in transposed]
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 187, in <listcomp>
19:26:39     return [default_collate(samples) for samples in transposed]
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 162, in default_collate
19:26:39     storage = batch[0].storage()._new_shared(numel)
19:26:39   File "/var/lib/jenkins/pytorch-ci-env/miniconda3/lib/python3.6/site-packages/torch/storage.py", line 118, in _new_shared
19:26:39     return cls._new_using_filename(size)
19:26:39 RuntimeError: std::exception at /private/var/lib/jenkins/workspace/pytorch-builds/pytorch-macos-10.13-py3-build/torch/lib/libshm/core.cpp:99
```

log: https://ci.pytorch.org/jenkins/job/pytorch-builds/job/pytorch-macos-10.13-py3-test1/4002/console