question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bad file descriptor ERROR when run train_faster_rcnn.py

See original GitHub issue

Hi, when I try to run train_faster_rcnn.py and eval_faster_rcnn.py it is fail by some OSError,Bad file descriptor. Thanks for your attenation.

INFO:root:Namespace(batch_size=2, dataset='voc', epochs=30, gpus='0,1', log_interval=100, lr=0.001, lr_decay=0.1, lr_decay_epoch='14,20', momentum=0.9, network='resnet50_v2a', num_workers=8, resume='', save_interval=1, save_prefix='faster_rcnn_resnet50_v2a_voc', seed=233, start_epoch=0, val_interval=1, verbose=False, wd=0.0005)
INFO:root:Start training from [Epoch 0]
Process Process-2:
Traceback (most recent call last):
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/site-packages/mxnet-1.2.0-py3.6.egg/mxnet/gluon/data/dataloader.py", line 157, in worker_loop
    data_queue.put((idx, batch))
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/queues.py", line 341, in put
    obj = _ForkingPickler.dumps(obj)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/site-packages/mxnet-1.2.0-py3.6.egg/mxnet/gluon/data/dataloader.py", line 64, in reduce_ndarray
    fd = multiprocessing.reduction.DupFd(fd)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/reduction.py", line 191, in DupFd
    return resource_sharer.DupFd(fd)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/resource_sharer.py", line 48, in __init__
    new_fd = os.dup(fd)
OSError: [Errno 9] Bad file descriptor
Process Process-6:
Traceback (most recent call last):
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/site-packages/mxnet-1.2.0-py3.6.egg/mxnet/gluon/data/dataloader.py", line 157, in worker_loop
    data_queue.put((idx, batch))
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/queues.py", line 341, in put
    obj = _ForkingPickler.dumps(obj)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/site-packages/mxnet-1.2.0-py3.6.egg/mxnet/gluon/data/dataloader.py", line 64, in reduce_ndarray
    fd = multiprocessing.reduction.DupFd(fd)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/reduction.py", line 191, in DupFd
    return resource_sharer.DupFd(fd)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/resource_sharer.py", line 48, in __init__
    new_fd = os.dup(fd)
OSError: [Errno 9] Bad file descriptor
Process Process-7:
Traceback (most recent call last):
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/site-packages/mxnet-1.2.0-py3.6.egg/mxnet/gluon/data/dataloader.py", line 157, in worker_loop
    data_queue.put((idx, batch))
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/queues.py", line 341, in put
    obj = _ForkingPickler.dumps(obj)
  File "/home/users/yunfan.lu/anaconda2/envs/py3/lib/python3.6/multiprocessing/reduction.py", line 51, in dumps
    cls(buf, protocol).dump(obj)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
masahicommented, Jun 21, 2018

Seeing the same error here. In my case, train_ssd.py works fine with num_worker = 6, but train_faster_rcnn.py gives the Bad file descriptor error whenever num_worker > 0. num_worker = 0 works fine.

I’m using mxnet 1.3 built from source recently.

0reactions
yunfanLucommented, Jun 22, 2018

Thank you !

I update the mxnet to the latest and fixed this Error

Read more comments on GitHub >

github_iconTop Results From Across the Web

[AIR] `[Error 9] Bad file descriptor` after running ... - GitHub
[AIR] [Error 9] Bad file descriptor after running TensorflowTrainer.fit ... /pool.py", line 268, in __del__ (BaseWorkerMixin pid=9064) self.
Read more >
Bad file descriptor error - python - Stack Overflow
you've only opened the file fout for writing, not reading. To open for both use fout = file('test.out','r+b').
Read more >
Solved: Bad file descriptor error when Updating attributes
UpdateParameters.py", line 10, in __init__ IOError: [Errno 9] Bad file descriptor Failed to execute (Stewardship32).
Read more >
OpenCV HOG Hyperparameter Tuning for Accurate and Fast ...
In the last week's tutorial, we discussed the HOG Feature Descriptor. We also learned how to do image classification using HOG features and ......
Read more >
Proceedings of 3rd International Conference on Computer ...
two consequent image frames, running outlier rejection sub-routine and estimating ... Table 1 Rotation and translation error value for full descriptor and ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found