Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com In-Reply-To: <55E0A3E94323974F83CFC5AAB96F68B801418A0B@snnexc03.in.ce.com.au> To: Sonam Chauhan Cc: cygwin AT cygwin DOT com Subject: Re: problems in Perl process management MIME-Version: 1.0 From: Jurgen Defurne Message-ID: Date: Tue, 10 May 2005 13:12:05 +0200 Content-Type: multipart/mixed; boundary="=_mixed 003D9AF0C1256FFD_=" X-IsSubscribed: yes Note-from-DJ: This may be spam --=_mixed 003D9AF0C1256FFD_= Content-Type: text/plain; charset="US-ASCII" I also would like to know if it is possible. However, it could be that it has nothing to do with Cygwin. I have a Perl script which forks several children and monitors their output. If a child fails, then it has no use to run all forked processes further and I kill them with the perl 'kill' command. However, I also notice that deeper forked processes (grandchildren) refuse to die. This script is only run using ActiveState Perl. I think it is really a serious Windows problem, because using the task manager it also seems not really possible to kill a complete process hierarchy. Regards, Jurgen Defurne Sonam Chauhan Sent by: cygwin-owner AT cygwin DOT com 2005-05-10 10:41 AM To: "'cygwin AT cygwin DOT com'" cc: (bcc: Jurgen Defurne/BRG/CE/PHILIPS) Subject: problems in Perl process management Classification: Hello - I'd appreciate help with problems doing process management in Cygwin/Perl. I have a Perl application that creates child processes - I need it to kill processes that exceed a certain timeout. I am trying to use the Proc::ProcessTable and Proc::Killfam CPAN modules for this. I ran into two problems: The first problem was a "can't stat /dev" error message produced when calling Proc::Killfam. This problem was fixed by a script I found that populated entries under /dev. To understand the next probem, have a look at the simple test script attached. The script forks a child process, which runs `sleep` in a third process. The parent process then tries to kill both children on expiry of a timeout. The script behaves perfectly on Linux -- it works as expected and kills the fork-ed child Perl process, as well it's `sleep` child process. However, on Cygwin/Perl it only kills the fork-ed Perl child - it cannot kill the `sleep`-ing child. The problem seems to be that the process table data returned by Proc::ProcessTable seems to differ from the data returned 'ps'. Specifically, Proc::ProcessTable returns the WINPID of a process as the PID for the backticked `sleep` process. The closest issue I found in the list archives is this one: http://sourceware.org/ml/cygwin/2005-02/msg00224.html It does not seem to have been resolved. I'm running Perl on Cygwin on Windows XP SP2. Running 'cygcheck -c' gives the following package status for cygwin and Perl: -------------------------- cygwin 1.5.16-1 OK perl 5.8.6-4 OK -------------------------- Can anyone help? Regards, Sonam Chauhan -- Electronic Commerce, Corporate Express Australia Ltd. Phone: +61-2-9335-0725, Email: sonam DOT chauhan AT ce DOT com DOT au -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --=_mixed 003D9AF0C1256FFD_= Content-Type: application/octet-stream; name="timeout_test2.pl" Content-Disposition: attachment; filename="timeout_test2.pl" Content-Transfer-Encoding: base64 IyEvdXNyL2Jpbi9wZXJsIA0KdXNlIFByb2M6OktpbGxmYW07DQoNCiNBbGFy bSBTaWduYWwgSGFuZGxlciAtIGtpbGxzIGFsbCBjaGlsZHJlbiBzdWJwcm9j ZXNzZXMNCiRTSUd7QUxSTX0gPSBzdWIgew0KCXByaW50ICIkJDogd29rZSB1 cCBhZnRlciAkdGltZW91dCBzZWMuIEtpbGxpbmcgY2hpbGQgZmFtaWx5OiAk Y2hpbGRwaWRcbiI7ICANCgkjIFRoaXMga2lsbHMgYWxsIGNoaWxkcmVuIHBy b2Nlc3NlcyANCglraWxsZmFtICdLSUxMJywgJGNoaWxkcGlkOyANCgkjIEhv d2V2ZXIsIG9uIFBlcmwvQ3lnd2luLCB0aGUgYmFja3RpY2tlZCBgc2xlZXBg IHByb2Nlc3MgaXMgbm90IGtpbGxlZA0KfTsgDQoNCiMgTWFpbiByb3V0aW5l IC0gc2V0cyBhbGFybSBhbmQgZm9ya3MgY2hpbGQgdG8gc3RhcnQgYSBibG9j a2luZyBgc2xlZXBgDQpzdWIgdGltZW91dF90ZXN0IHsNCglwcmludCAiU3Rh cnRpbmcuLi4gbXkgb3duIFBJRD0kJFxuIjsNCgkkdGltZW91dCA9MzsNCgkk Y2hpbGRwaWQgPSBmb3JrKCk7DQoJaWYgKCRjaGlsZHBpZCA+IDApIHsgIyB0 aGlzIGlzIHRoZSBwYXJlbnQgcHJvY2VzcyAtIHdhaXQgZm9yIGNoaWxkcmVu IHRvIGRpZQ0KCQlwcmludCAiJCQ6IEZvcmtlZCBjaGlsZCAkY2hpbGRwaWQu IFNldCBhbGFybSBmb3IgJHRpbWVvdXQgc2Vjb25kc1xuIjsNCgkJYWxhcm0g JHRpbWVvdXQ7DQoJCWRvIHsNCgkJCSRraWQgPSB3YWl0cGlkICgtMSwgMCk7 DQoJCX0gdW50aWwgJGtpZCA9PSAtMTsNCgkJZXhpdDsNCgl9DQoJJHMgPSBg L2Jpbi9zbGVlcCA3YDsNCglwcmludCAiU2xlZXAgZW5kZWQiOw0KfQ0KDQoj IEtpY2sgaXQgYWxsIG9mZiANCnRpbWVvdXRfdGVzdCgpOw0KDQoNCg0K --=_mixed 003D9AF0C1256FFD_= Content-Type: text/plain; charset=us-ascii -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --=_mixed 003D9AF0C1256FFD_=--