classification
Title: processes created by subprocess.Popen is not terminating
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: eric.smith, jack__d, rajeevkchaurasia
Priority: normal Keywords:

Created on 2021-06-16 07:16 by rajeevkchaurasia, last changed 2021-06-18 02:21 by eric.smith. This issue is now closed.

Messages (4)
msg395909 - (view) Author: Rajeev Chaurasia (rajeevkchaurasia) Date: 2021-06-16 07:16
I am using Linux OS and using multiprocessing in my application.

The child process execution get completed but the processes are not terminating.


childprocess = "/opt/oracle.ahf/exachk/exachk -silentforce -showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0"

session = subprocess.Popen(childprocess, shell = True)
session.communicate()  

From the log I can see execution of childprocess scripts(exachk and exachk.py) is completed successfully but the process remains alive forever. Also the parent process from where I am using subprocess.Popen that also remains alive.
----------------------------------------------------
# ps -ef|grep exachk
(P1)     278988 247699  0 18:46 ?        00:00:00 sh /opt/oracle.ahf/exachk/exachk -silentforce -showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0
(P2)     279873 278988 39 18:46 ?        00:12:51 /opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce -showpass -dball -nocvu -autorun_id DEFAULT -localonly
----------------------------------------------------

Please help!
-Rajeev
msg395946 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-06-16 16:00
This is probably not a python bug. But if you can demonstrate it without needing to install the Oracle software, we can take a look at it. You've also not explained how you're using multiprocessing. We need an complete, short, working example program to determine if it's a python bug.

I suggest you ask this question on Stack Overflow.

Also, I'd suggest subprocess.run instead of .communicate, if you can.
msg395950 - (view) Author: Jack DeVries (jack__d) * Date: 2021-06-16 16:28
For future reference, here are some good guidelines for submitting bug reports and asking for help to debug your code:

https://stackoverflow.com/help/minimal-reproducible-example

http://www.sscce.org/
msg396028 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-06-18 02:21
I'm going to close this. If you can reproduce it with a smaller program that we can test, please attach the information and re-open this issue.
History
Date User Action Args
2021-06-18 02:21:12eric.smithsetstatus: open -> closed
type: behavior
messages: + msg396028

resolution: not a bug
stage: resolved
2021-06-16 16:28:10jack__dsetstatus: pending -> open
nosy: + jack__d
messages: + msg395950

2021-06-16 16:00:26eric.smithsetstatus: open -> pending
nosy: + eric.smith
messages: + msg395946

2021-06-16 07:16:43rajeevkchaurasiacreate