Bug report
As per title. In my case I triggered the os.waitpid() using psutil library, but easily reproducible using os.waitpid, too.
Reproduction:
Python 3.9.5 (default, Nov 18 2021, 16:00:48)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Process
>>> import os
>>> import time
>>> p = Process(target=time.sleep, args=(10,))
>>> p.start(); os.waitpid(p.pid, 0)
(17587, 0)
>>> p.is_alive()
True
>>> p.join() # Returns immediately
>>>
I understand it's something of a corner case; however, join() behaves correctly here, so we definitely have enough info about whether the process is alive.
By the looks of it, if the process has been already waited on, poll() Popen method in multiprocessing returns None, which is interpreted as the process being still alive.
Your environment
CPython versions tested on: 3.9.5, but main version seems affected
Operating system and architecture: x64 Ubuntu Linux
The text was updated successfully, but these errors were encountered:
Bug report
As per title. In my case I triggered the os.waitpid() using psutil library, but easily reproducible using os.waitpid, too.
Reproduction:
I understand it's something of a corner case; however, join() behaves correctly here, so we definitely have enough info about whether the process is alive.
By the looks of it, if the process has been already waited on,
poll()
Popen method in multiprocessing returns None, which is interpreted as the process being still alive.Your environment
The text was updated successfully, but these errors were encountered: