data icon indicating copy to clipboard operation
data copied to clipboard

Daemonize reading service's processes

Open VitalyFedyunin opened this issue 2 years ago • 2 comments

Stack from ghstack (oldest at bottom):

  • #824
  • -> #823

fixes: #806

Differential Revision: D40280665

VitalyFedyunin avatar Oct 11 '22 21:10 VitalyFedyunin

@VitalyFedyunin has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

VitalyFedyunin avatar Oct 11 '22 21:10 VitalyFedyunin

I just tried this locally. It does terminate but it returns the following error:

Exception ignored in: <function DataLoader2.__del__ at 0x7f96eb666820>
Traceback (most recent call last):
  File "/Users//data/torchdata/dataloader2/dataloader2.py", line 134, in __del__
  File "/Users//data/torchdata/dataloader2/dataloader2.py", line 142, in shutdown
  File "/Users//data/torchdata/dataloader2/reading_service.py", line 296, in finalize
  File "/Users//data/torchdata/dataloader2/reading_service.py", line 291, in clean_me
AttributeError: 'NoneType' object has no attribute 'TerminateRequest'
Exception ignored in: <function PrototypeMultiProcessingReadingService.__del__ at 0x7f96eb668af0>
Traceback (most recent call last):
  File "/Users//data/torchdata/dataloader2/reading_service.py", line 284, in __del__
  File "/Users//data/torchdata/dataloader2/reading_service.py", line 296, in finalize
  File "/Users//data/torchdata/dataloader2/reading_service.py", line 291, in clean_me
AttributeError: 'NoneType' object has no attribute 'TerminateRequest'

This is the common problem that Python has already exited before __del__ is invoked. We can simply check if those variables/modules are None. If None, we can skip cleanup and return directly.

ejguan avatar Oct 14 '22 18:10 ejguan

That's one of the options. Also requires join timeouts and errors propagation.

VitalyFedyunin avatar Oct 16 '22 18:10 VitalyFedyunin

This can be closed as #837 has landed

NivekT avatar Oct 19 '22 15:10 NivekT