celery / billiard

Multiprocessing Pool Extensions
Other
411 stars 249 forks source link

Hard Timeout Triggers AttributeError on Windows #375

Open fedeesku opened 2 years ago

fedeesku commented 2 years ago

Hi Team,

Running Billiards 4.0.2 on Windows 10.

A hard timeout threshold triggers the following error:

Thread 'TimeoutHandler' crashed: AttributeError("module 'os' has no attribute 'getpgid'") Traceback (most recent call last): File "xxx\lib\site-packages\billiard\pool.py", line 504, in run return self.body() File "xxx\lib\site-packages\billiard\pool.py", line 763, in body for _ in self.handle_timeouts(): File "xxx\lib\site-packages\billiard\pool.py", line 754, in handle_timeouts on_hard_timeout(job) File "xxx\lib\site-packages\billiard\pool.py", line 697, in on_hard_timeout self._trywaitkill(process) File "xxx\lib\site-packages\billiard\pool.py", line 702, in _trywaitkill if os.getpgid(worker.pid) == worker.pid: AttributeError: module 'os' has no attribute 'getpgid'

I believe if the OS is Windows then you should skip the first if statement and go directly to the else. Windows does not support getpgid.

Adding a sys.platform != "win32" as the first check in line 702 and 713 seems to fix the issue.

reggiepy commented 5 months ago

Hi Team,

Running Billiards 4.0.2 on Windows 10.

A hard timeout threshold triggers the following error:

Thread 'TimeoutHandler' crashed: AttributeError("module 'os' has no attribute 'getpgid'") Traceback (most recent call last): File "xxx\lib\site-packages\billiard\pool.py", line 504, in run return self.body() File "xxx\lib\site-packages\billiard\pool.py", line 763, in body for _ in self.handle_timeouts(): File "xxx\lib\site-packages\billiard\pool.py", line 754, in handle_timeouts on_hard_timeout(job) File "xxx\lib\site-packages\billiard\pool.py", line 697, in on_hard_timeout self._trywaitkill(process) File "xxx\lib\site-packages\billiard\pool.py", line 702, in _trywaitkill if os.getpgid(worker.pid) == worker.pid: AttributeError: module 'os' has no attribute 'getpgid'

I believe if the OS is Windows then you should skip the first if statement and go directly to the else. Windows does not support getpgid.

Adding a sys.platform != "win32" as the first check in line 702 and 713 seems to fix the issue.

Thank you, I happen to have the same problem