未验证 提交 d17681dc 编写于 作者: K Kaipeng Deng 提交者: GitHub

fix DataLoader single process mode exit SIGABRT error. (#27850)

* fix DataLoader single process mode exit SIGABRT error. test=develop
上级 7750844f
...@@ -346,6 +346,12 @@ class _DataLoaderIterSingleProcess(_DataLoaderIterBase): ...@@ -346,6 +346,12 @@ class _DataLoaderIterSingleProcess(_DataLoaderIterBase):
def next(self): def next(self):
return self.__next__() return self.__next__()
def __del__(self):
# _blocking_queue in keep order mode holds sub-threads
# need to release thread resources on unexpected exit
if self._blocking_queue:
self._blocking_queue.close()
# NOTE(chenweihang): _worker_loop must be top level method to be pickled # NOTE(chenweihang): _worker_loop must be top level method to be pickled
def _worker_loop(dataset, dataset_kind, indices_queue, out_queue, done_event, def _worker_loop(dataset, dataset_kind, indices_queue, out_queue, done_event,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册