Re: Re: [Zope] defunct process with os.spawn*
Guys, I must say that I really appreciate your attention, that's pretty cool to have such a nice people to give support to newbies like me. Based on what got here I found a solution that worked for me: pid_test,st=os.waitpid(jpid,os.WNOHANG) Now, let's go for the next trouble... Cheers, Alan On 02/08/06, Chris McDonough <[EMAIL PROTECTED]> wrote: You need to call os.waitpid() at some point to clean up finished processes. - C On Aug 2, 2006, at 1:59 PM, Jonathan wrote: > > - Original Message - From: "Alan" <[EMAIL PROTECTED]> > To: > Sent: Wednesday, August 02, 2006 1:52 PM > Subject: [Zope] defunct process with os.spawn* > > >> Dears, >> >> Now I am facing an annoying problem. >> >> I have an application in Zope which calls a External Method, which >> calls a bash script via: >> >> var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh', >> arg1,arg2) >> >> The idea is to start some programs in background (which will take >> hours running) and I need to pass arguments and track its PID for >> eventually checking its status. So os.spawnlp seemed the perfect >> solution. >> >> However, when my bash script finished, my processes gets >> childed to the Zope process. And only restarting Zope to get rid of >> such defunct process, an unthinkable solution. > > It sounds like you are generating zombie processes (child processes > which have completed, but are not handled by the processes that > spawned them). Try googling: python reap spawned process > > > Jonathan > > > ___ > Zope maillist - Zope@zope.org > http://mail.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce > http://mail.zope.org/mailman/listinfo/zope-dev ) > -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28<< ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] defunct process with os.spawn*
You need to call os.waitpid() at some point to clean up finished processes. - C On Aug 2, 2006, at 1:59 PM, Jonathan wrote: - Original Message - From: "Alan" <[EMAIL PROTECTED]> To: Sent: Wednesday, August 02, 2006 1:52 PM Subject: [Zope] defunct process with os.spawn* Dears, Now I am facing an annoying problem. I have an application in Zope which calls a External Method, which calls a bash script via: var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh', arg1,arg2) The idea is to start some programs in background (which will take hours running) and I need to pass arguments and track its PID for eventually checking its status. So os.spawnlp seemed the perfect solution. However, when my bash script finished, my processes gets childed to the Zope process. And only restarting Zope to get rid of such defunct process, an unthinkable solution. It sounds like you are generating zombie processes (child processes which have completed, but are not handled by the processes that spawned them). Try googling: python reap spawned process Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] defunct process with os.spawn*
- Original Message - From: "Alan" <[EMAIL PROTECTED]> To: Sent: Wednesday, August 02, 2006 1:52 PM Subject: [Zope] defunct process with os.spawn* Dears, Now I am facing an annoying problem. I have an application in Zope which calls a External Method, which calls a bash script via: var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh', arg1,arg2) The idea is to start some programs in background (which will take hours running) and I need to pass arguments and track its PID for eventually checking its status. So os.spawnlp seemed the perfect solution. However, when my bash script finished, my processes gets childed to the Zope process. And only restarting Zope to get rid of such defunct process, an unthinkable solution. It sounds like you are generating zombie processes (child processes which have completed, but are not handled by the processes that spawned them). Try googling: python reap spawned process Jonathan ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
[Zope] defunct process with os.spawn*
Dears, Now I am facing an annoying problem. I have an application in Zope which calls a External Method, which calls a bash script via: var_pid = os.spawnlp(os.P_NOWAIT, 'script.sh', 'script.sh', arg1,arg2) The idea is to start some programs in background (which will take hours running) and I need to pass arguments and track its PID for eventually checking its status. So os.spawnlp seemed the perfect solution. However, when my bash script finished, my processes gets childed to the Zope process. And only restarting Zope to get rid of such defunct process, an unthinkable solution. I am running: Plone 2.1.2, Zope (Zope 2.8.5-final, python 2.3.5, sunos5), Python 2.3.5 (#1, Feb 14 2006, 10:51:41) [C], -- Alan Wilter S. da Silva, D.Sc. - Research Associate Department of Biochemistry, University of Cambridge. 80 Tennis Court Road, Cambridge CB2 1GA, UK. http://www.bio.cam.ac.uk/~awd28<< ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )