This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nsmcan
Recipients Benedek Rácz, Jurko.Gospodnetić, eric.smith, eryksun, nsmcan, paul.moore, steve.dower, tim.golden, uranusjr, zach.ware
Date 2020-10-08.19:34:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1602185651.2.0.0253021629311.issue38905@roundup.psfhosted.org>
In-reply-to
Content
Hello,

I've just run into a related issue. I have a python script, which starts an another python script using subprocess.Popen(). The parent script gets pid of the child and monitors up its activity through a database by this pid. The child script updates its activity in the database using the pid it gotten from os.getpid()

Both scripts live in a virtual environment.

It worked fine in Python 3.5 and stopped working after migration to Python 3.8.

My base Python location: D:\Python\Python38\pythonw.exe
Virtual Environment: D:\test\venv\Scripts\pythonw.exe

I have realized, that when I run the following from a command prompt:
D:\test\venv\Scripts\pythonw.exe test.py

2 processes with the different PIDs are created:
PID:                   97040
Parent PID:            12004  (cmd.exe)
Command Line:          D:\test\venv\Scripts\pythonw.exe test.py

PID:                   85548
Parent PID:            97040  (pythonw.exe)
Command Line:          D:\Python\Python38\pythonw.exe test.py

It is definitely a regression, and will potentially break a lot of applications expecting a child Python process to be a direct descendant of its parent.

Also it is a waste of system resources
History
Date User Action Args
2020-10-08 19:34:11nsmcansetrecipients: + nsmcan, paul.moore, eric.smith, tim.golden, Jurko.Gospodnetić, zach.ware, eryksun, steve.dower, uranusjr, Benedek Rácz
2020-10-08 19:34:11nsmcansetmessageid: <1602185651.2.0.0253021629311.issue38905@roundup.psfhosted.org>
2020-10-08 19:34:11nsmcanlinkissue38905 messages
2020-10-08 19:34:11nsmcancreate