New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PATCH] Full example of REAPER in perlipc #12124
Comments
From worldmind@mail.ruThis is a bug report for perl from worldmind@mail.ru, From d8632592e47bbd5b8e879732d9c5c288536fd169 Mon Sep 17 00:00:00 2001 pod/perlipc.pod | 14 ++++++++------ Inline Patchdiff --git a/pod/perlipc.pod b/pod/perlipc.pod
index 7650838..9b62a0f 100644
--- a/pod/perlipc.pod
+++ b/pod/perlipc.pod
@@ -117,18 +117,20 @@ therefore block.
The best way to prevent this issue is to use waitpid(), as in the
- use POSIX ":sys_wait_h"; # for nonblocking read my %children; $SIG{CHLD} = sub { while (1) { Flags: Site configuration information for perl 5.14.2: Configured by Debian Project at Fri Mar 23 17:14:02 UTC 2012. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: Locally applied patches: @INC for perl 5.14.2: Environment for perl 5.14.2: PATH=/home/worldmind42/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games |
From @cpansproutOn Mon May 21 13:33:30 2012, worldmind@mail.ru wrote:
Tom, can you comment on this? -- Father Chrysostomos |
From [Unknown Contact. See original ticket]On Mon May 21 13:33:30 2012, worldmind@mail.ru wrote:
Tom, can you comment on this? -- Father Chrysostomos |
@cpansprout - Status changed from 'new' to 'open' |
From @LeontOn Mon, May 21, 2012 at 10:33 PM, Alexey Shrub
Good point. This is the kind of pitfall that should probable be Leon |
From @LeontOn Tue, May 22, 2012 at 5:05 PM, Leon Timmermans <fawaka@gmail.com> wrote:
On second reading, that does not seem necessary. The process will Leon |
From worldmind@mail.ruПтн. Май 25 04:21:50 2012, LeonT писал:
As I understand you say that we can skip WIFEXITED($?) and ps aux | grep fork-test.pl 2. Send STOP signal to child we got warn message 'Get CHLD signal at fork-test.pl line 7.' STOP signal it is not exit - process can continue working after CONT signal |
From @tonycozOn Fri May 25 06:08:13 2012, worldmind wrote:
I don't think this answers Leon's objection - waitpid() will only return If you modify your code to check waitpid: $SIG{CHLD} = sub { then you don't get the warning on a STOP. That said, the waitpid() loop is required (which the cookbook doesn't Tony |
From @tonycozOn Fri May 25 04:21:50 2012, LeonT wrote:
I've attached a simplified patch that changes the single waitpid() call Looking at the text around that example, I wonder if this example could Tony |
From @tonycoz0001-perl-113028-handle-multiple-children-exiting-in-perl.patchFrom 734b0722f62d7141a53d8389bc39dc9181581da9 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Fri, 12 Jul 2013 17:12:46 +1000
Subject: [PATCH] [perl #113028] handle multiple children exiting in perlipc
example
---
pod/perlipc.pod | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/pod/perlipc.pod b/pod/perlipc.pod
index 69567e9..decb59b 100644
--- a/pod/perlipc.pod
+++ b/pod/perlipc.pod
@@ -124,11 +124,10 @@ example:
$SIG{CHLD} = sub {
# don't change $! and $? outside handler
local ($!, $?);
- my $pid = waitpid(-1, WNOHANG);
- return if $pid == -1;
- return unless defined $children{$pid};
- delete $children{$pid};
- cleanup_child($pid, $?);
+ while ( (my $pid = waitpid(-1, WNOHANG)) > 0 ) {
+ delete $children{$pid};
+ cleanup_child($pid, $?);
+ }
};
while (1) {
--
1.7.10.4
|
From @tonycozOn Fri Jul 12 00:16:11 2013, tonyc wrote:
Applied as fd44020. Tony |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#113028 (status was 'resolved')
Searchable as RT113028$
The text was updated successfully, but these errors were encountered: