Re: Forking as another user

2016-03-14 Thread Lars Noodén
On 03/13/2016 02:14 PM, Peter Scott wrote: > On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote: [snip] >> What modification can prevent zombies yet allow multiple concurrent >> clients to attach? > > You need the WNOHANG option on your wait() to make it nonblocking. Thanks. I've been

Re: Forking as another user

2016-03-13 Thread Peter Scott
On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote: > The snippet below works to fork as a specific user, if run as root. > However, it generates zombies. The functions wait() or waitpid() seem > to be available to use to stop that, but if I insert either of them in > the outer while loop,

Re: Forking as another user

2016-03-12 Thread Lars Noodén
Thanks, David and Shlomi (and those that read), I understand fork() and the style of writing better. Strange that the defaults for 'use English' are not optimal. The snippet below works to fork as a specific user, if run as root. However, it generates zombies. The functions wait() or waitpid()

Re: Forking as another user

2016-03-12 Thread Shlomi Fish
Hi Lars, some comments on your code: On Fri, 11 Mar 2016 20:22:34 +0200 Lars Noodén wrote: > If I have the code below to fork a child process, how would the right > way be to fork as a different user? I gather that fork() itself does > not support that, so some other

Re: Forking as another user

2016-03-11 Thread David Emanuel da Costa Santiago
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Hello all. AFAIK, you can't do that. When you fork everything is copied, including the UID. To achieve something similar, you need to launch another process (but you'll need to be root to launch it as another user) Regards, David Santiago On

Forking as another user

2016-03-11 Thread Lars Noodén
If I have the code below to fork a child process, how would the right way be to fork as a different user? I gather that fork() itself does not support that, so some other method must be used. Regards, Lars - #!/usr/bin/perl use strict; use warnings; use English;# for $UID and such my

Forking question

2012-08-10 Thread G M
Hi, I'm working on a forking process and I need a way to check if any of the processes have failed and if they have restart them. Can anyone point me in the right direction to a tutorial or explanation of how to do this? Thanks in advance, Graeme

Re: Forking question

2012-08-10 Thread Shlomi Fish
Hi Graeme, On Fri, 10 Aug 2012 10:10:10 +0100 G M iamnotregiste...@hotmail.com wrote: Hi, I'm working on a forking process and I need a way to check if any of the processes have failed and if they have restart them. Can anyone point me in the right direction to a tutorial or explanation

Re: Forking question

2012-08-10 Thread pangj
Hi, I'm working on a forking process and I need a way to check if any of the processes have failed and if they have restart them. Can anyone point me in the right direction to a tutorial or explanation of how to do this? Or use a server framework like POE which manages forking for you

Re: Forking question

2012-08-10 Thread David Christensen
On 08/10/12 02:10, G M wrote: I'm working on a forking process and I need a way to check if any of the processes have failed and if they have restart them. Can anyone point me in the right direction to a tutorial or explanation of how to do this? Network Programming with Perl by Lincoln D

Re: perl process forking tutorial recommendation

2011-06-16 Thread Jeff Peng
And the book Network programming with Perl is a good book for Perl client/server development including the fork stuff. -Original Message- From: dery...@gmail.com Sent: Wed, 15 Jun 2011 13:11:38 -0700 (PDT) To: beginners@perl.org Subject: Re: perl process forking tutorial

perl process forking tutorial recommendation

2011-06-15 Thread Noah
Hi there, can somebody recommend a good tutorial web link and/or URL for learning perl forking please? Cheerss Noah -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Re: perl process forking tutorial recommendation

2011-06-15 Thread C.DeRykus
On Jun 15, 11:21 am, noah-l...@enabled.com (Noah) wrote: Hi there, can somebody recommend a good tutorial web link and/or URL for learning perl forking please? Presumably, you've already seen these docs: perldoc perlipc perldoc perlfork # fork emulation for non-Unix Not the best

how to choose a threading or forking http server module from CPAN

2009-07-06 Thread XUFENG
Hi, I plan to implement a threading or forking http server to receive client request,after handling the requested url,it gives out new urls. What is the better module to use? Thank you for any suggestions. -- XUFENG 2009-07-06

Re: how to choose a threading or forking http server module from CPAN

2009-07-06 Thread Jeff Pang
2009/7/6 XUFENG xufeng...@sina.com: Hi,        I plan to implement a threading or forking http server to receive client request,after handling the requested url,it gives out new urls.        What is the better module to use? A perl module or httpd module? for perl module, could use CGI.pm

Re: how to choose a threading or forking http server module from CPAN

2009-07-06 Thread Randal L. Schwartz
XUFENG == XUFENG xufeng...@sina.com writes: XUFENG Hi, XUFENG I plan to implement a threading or forking http server to receive client request,after handling the requested url,it gives out new urls. XUFENG What is the better module to use? XUFENG Thank you for any suggestions

Forking in Perl code

2009-05-14 Thread Anirban Adhikary
Hi List I am trying to write a code which will work as self monitoring script. The parent will work for something and child will check that parent program is running or not . If parent is not running or somehow killed or crashed then child will restart the parent . But I am not getting the

Re: Forking in Perl code

2009-05-14 Thread John W. Krahn
Anirban Adhikary wrote: Hi List Hello, I am trying to write a code which will work as self monitoring script. The parent will work for something and child will check that parent program is running or not . You want to do that the other way around. The child will do the work and the

forking problem with dbd::mysql

2007-05-09 Thread Jeremy Kister
I'm utilizing fork for the first time, and am having an issue which I can't track down. I've made a test program at http://jeremy.kister.net/code/ftest.pl to demonstrate. I expect this program to print 'SQL RESULT: 1' for as long as it can. SQL RESULT: 1 SQL RESULT: 1 SQL RESULT: 1

Re: forking problem with dbd::mysql [dupe]

2007-05-09 Thread Jeremy Kister
On 5/8/2007 6:46 PM, Jeremy Kister wrote: I'm utilizing fork for the first time, and am having an issue which I can't track down. I sent this original email with a bad return address. Four and a half hours later, when the post still didnt make it to the list, I realized that the I had used a

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Jeremy Kister [EMAIL PROTECTED] wrote: On 5/9/2007 12:01 AM, Jeff Pang wrote: 1) too less timeout setting in my.cnf? see /etc/my.cnf and look for this line: I actually have no my.cnf. But if I s/my $pid = fork()/my $pid=1/ all works fine, even with 60 second sleeps. 2) as we

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Chas Owens [EMAIL PROTECTED] wrote: snip It looks like it has something to do with $dbh going out of scope (when the child exits). snip This is definitely a case of the database handle auto-disconnecting when it is destroyed. You can see the behavior by creating a set of DBI

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] It looks like it has something to do with $dbh going out of scope (when the child exits). snip This is definitely a case of the database handle auto-disconnecting when it is destroyed. You can see the behavior by creating a set

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip This is the reason really.I was also confused for this case once. Thanks for Chas's explain. snip Knowing what is happening is only half the battle, now we need to find a non-hacky solution. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] Sent: May 9, 2007 11:25 PM To: Jeremy Kister [EMAIL PROTECTED] Cc: beginners@perl.org Subject: Re: forking problem with dbd::mysql On 5/9/07, Chas Owens [EMAIL PROTECTED] wrote: snip It looks like it has something to do with $dbh

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
(); } } Ok where in child when going out of scope the $dbh should get disconnected. But why this would affect the $dbh in parent?As we know,when forking child get a full copy of $dbh from parent and it's separate to parent's $dbh. snip But the connection information in the $dbh is the same, so when

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] Sent: May 10, 2007 12:02 AM To: Jeff Pang [EMAIL PROTECTED] Cc: beginners-list beginners@perl.org Subject: Re: forking problem with dbd::mysql On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip But still has a question for me.We may

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeremy Kister
On 5/9/2007 11:12 AM, Chas Owens wrote: my $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1}); to my $dbh = DBI-connect( $dsn, $dbun, $dbpw, { RaiseError = 1, mysql_auto_reconnect = 1 } ); Yes, that works, just as a regular my $dbh = DBI-connect()

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip Yes but I think is this maybe a bug in DBI class?For example,open a file handle and after forking child close that handle,this would not affect parent's handle. snip It definitely violates the principle of least surprise, but it is also

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Jeremy Kister [EMAIL PROTECTED] Sent: May 10, 2007 12:17 AM To: beginners@perl.org Subject: Re: forking problem with dbd::mysql On 5/9/2007 11:12 AM, Chas Owens wrote: my $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1}); to my $dbh = DBI-connect

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Jeremy Kister [EMAIL PROTECTED] wrote: On 5/9/2007 11:12 AM, Chas Owens wrote: my $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1}); to my $dbh = DBI-connect( $dsn, $dbun, $dbpw, { RaiseError = 1, mysql_auto_reconnect = 1 } ); Yes, that

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Chas Owens [EMAIL PROTECTED] wrote: On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip Yes but I think is this maybe a bug in DBI class?For example,open a file handle and after forking child close that handle,this would not affect parent's handle. snip It definitely violates

Re: forking problem with dbd::mysql

2007-05-09 Thread tom
: I'm am having an issue with a mysql connection that displays itself when there's forking going on which I can't track down. I've made a test program at http://jeremy.kister.net/code/ftest.pl to demonstrate. I expect this program to print 'SQL RESULT: 1' for as long as it can. But instead

Re: forking problem with dbd::mysql

2007-05-09 Thread tom
create the database connection after you fork(). On 5/9/2007, Chas Owens [EMAIL PROTECTED] wrote: On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip This is the reason really.I was also confused for this case once. Thanks for Chas's explain. snip Knowing what is happening is only

Re: forking problem with dbd::mysql

2007-05-09 Thread tom
[EMAIL PROTECTED] wrote: -Original Message- From: Chas Owens [EMAIL PROTECTED] Sent: May 10, 2007 12:02 AM To: Jeff Pang [EMAIL PROTECTED] Cc: beginners-list beginners@perl.org Subject: Re: forking problem with dbd::mysql On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: This is an interesting point, but I think a database might be more similar to a network socket than a file handle. I have this same observed behaviour under Oracle and PostgreSQL, so it's not limited to mysql (and shouldn't be fixed with

Re: forking problem with dbd::mysql

2007-05-09 Thread Tom Allison
sing its handle unexpectedly. The solution: Setting a flag (InactiveDestroy) on the parent's handle inside the child process prevents the automagic closing of the connection. * the magic in this case is the DESTROY method of DBI::db Where do you get the inactiveDestroy? Is this something

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] And happily such a flag exists: InactiveDestroy. Just add $dbh-{InactiveDestroy} = 1; to the child and the problem should go away. I'm also happy to know it,this is good. -- mailto:[EMAIL PROTECTED]

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Tom Allison [EMAIL PROTECTED] wrote: sing its handle unexpectedly. The solution: Setting a flag (InactiveDestroy) on the parent's handle inside the child process prevents the automagic closing of the connection. * the magic in this case is the DESTROY method of DBI::db Where

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Jeff Pang [EMAIL PROTECTED] wrote: snip Using InactiveDestroy flag seems a standard way since this module's author provide this flag. But it's maybe bring some problems when the applications are large enough,and it's not the fact that every programmer would disconnect their dbh

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] $dbh-{InactiveDestroy} = 1; $dbh = DBI-connect($dsn, $dbun, $dbpw, {RaiseError = 1}); # do stuff yes this is the same with my meanings.Child re-open another dbh

Re: forking problem with dbd::mysql

2007-05-09 Thread Tom Allison
On May 9, 2007, at 5:41 PM, Jeff Pang wrote: -Original Message- From: Chas Owens [EMAIL PROTECTED] The solution: Setting a flag (InactiveDestroy) on the parent's handle inside the child process prevents the automagic closing of the connection. * the magic in this case is the

Re: forking problem with dbd::mysql

2007-05-09 Thread Chas Owens
On 5/9/07, Tom Allison [EMAIL PROTECTED] wrote: snip In short -- you are lucky it can be supported. But in order to keep things portable, this might be something to avoid? In his case there is not a portability issue. What is not portable is using the parent's handle inside the child, but he

Re: forking problem with dbd::mysql

2007-05-09 Thread Jeff Pang
-Original Message- From: Chas Owens [EMAIL PROTECTED] In his case there is not a portability issue. What is not portable is using the parent's handle inside the child, but he is opening a new handle inside the child. The problem was the auto-close behavior which is made a non-problem by

forking problem with dbd::mysql

2007-05-08 Thread Jeremy Kister
I'm am having an issue with a mysql connection that displays itself when there's forking going on which I can't track down. I've made a test program at http://jeremy.kister.net/code/ftest.pl to demonstrate. I expect this program to print 'SQL RESULT: 1' for as long as it can. But instead: SQL

Re: forking problem with dbd::mysql

2007-05-08 Thread Jeff Pang
-Original Message- From: Jeremy Kister [EMAIL PROTECTED] Sent: May 9, 2007 11:05 AM To: beginners@perl.org Subject: forking problem with dbd::mysql I'm am having an issue with a mysql connection that displays itself when there's forking going on which I can't track down. I've made

Re: forking problem with dbd::mysql

2007-05-08 Thread Jeremy Kister
On 5/9/2007 12:01 AM, Jeff Pang wrote: 1) too less timeout setting in my.cnf? see /etc/my.cnf and look for this line: I actually have no my.cnf. But if I s/my $pid = fork()/my $pid=1/ all works fine, even with 60 second sleeps. 2) as we know,child exiting would return a SIGCHLD signal to

Trying to understand this forking open stuff...

2006-11-08 Thread Jen Spinney
Hello all! I've come to a point where I really need to start understanding forking, threaded, select, and all that stuff. I created a test script to play around with and it's doing what I'd expect, except for one bit. My test script: use strict; use warnings; print First Trial:\n\n

Re: Trying to understand this forking open stuff...

2006-11-08 Thread John W. Krahn
Jen Spinney wrote: Hello all! Hello, print \nSecond Trial:\n\n; if (open(CHILD, |-)) { print parent starts: , (scalar localtime),\n; print CHILD printing to child\n; sleep 5; print parent ends: , (scalar localtime),\n; } else { my $time = scalar localtime; my

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jen Spinney
On 11/8/06, John W. Krahn [EMAIL PROTECTED] wrote: Jen Spinney wrote: Hello all! Hello, print \nSecond Trial:\n\n; if (open(CHILD, |-)) { print parent starts: , (scalar localtime),\n; print CHILD printing to child\n; sleep 5; print parent ends: , (scalar localtime),\n; }

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jay Savage
On 11/8/06, Jen Spinney [EMAIL PROTECTED] wrote: use strict; use warnings; print First Trial:\n\n; if (open(CHILD, |-)) { print parent starts: , (scalar localtime),\n; sleep 5; print parent ends: , (scalar localtime),\n; } else { print child starts: , (scalar localtime),\n;

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Tom Phoenix
On 11/8/06, Jen Spinney [EMAIL PROTECTED] wrote: print CHILD printing to child\n; sleep 5; Concurrent processes can be counterintuitive at times. Because the CHILD filehandle is buffered, that line won't necessarily be sent to the child process right away. In your program, I'd expect

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jen Spinney
On 11/8/06, Jay Savage [EMAIL PROTECTED] wrote: There are a couple of things going on here. First, the issue of what prints when is driven by buffering. Since you haven't turned on autofulsh on any of your file handles, the buffer is flushed whenever it's convenient for the the system. The

Re: Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jay Savage
On 11/8/06, Jen Spinney [EMAIL PROTECTED] wrote: Thanks Jay and Tom! I added this little bit to my script: select (CHILD); $| = 1; select (STDOUT); and it worked just as I expected it to. It's interesting, though, that I've been working with sockets a bunch through IO::Socket and my print

Re: Trying to understand this forking open stuff...

2006-11-08 Thread Jeff Pang
Thanks Jay and Tom! I added this little bit to my script: select (CHILD); $| = 1; select (STDOUT); and it worked just as I expected it to. It's interesting, though, that I've been working with sockets a bunch through IO::Socket and my print statements seem to print to the socket stream

Re: not forking

2006-05-16 Thread Tom Allison
Paul Johnson wrote: On Mon, May 15, 2006 at 04:46:07PM -0400, Tom Allison wrote: I've got a *bunch* of code that I've been rewriting recently and ran into a rather weird problem. it won't fork. If I write the following: foreach my $file ( @$files ) { my $pid = fork(); print $pid --

not forking

2006-05-15 Thread Tom Allison
-- file_two but no 3243--file_two. Repeated print statements later on in the job continue to indicate that this is not forking correctly. I've been changing a number of things over to objects and references, but I can't see anyway that this would interfere with something so fundamental. Unfortunately

Re: not forking

2006-05-15 Thread Paul Johnson
On Mon, May 15, 2006 at 04:46:07PM -0400, Tom Allison wrote: I've got a *bunch* of code that I've been rewriting recently and ran into a rather weird problem. it won't fork. If I write the following: foreach my $file ( @$files ) { my $pid = fork(); print $pid -- $file\n;

Re: not forking

2006-05-15 Thread Tom Phoenix
On 5/15/06, Tom Allison [EMAIL PROTECTED] wrote: my $pid = fork(); print $pid -- $file\n; Because your process table can become full and temporarily prevent forking new processes, you should check the return value of fork whenever you're making more than N processes. The value of N

Re: not forking

2006-05-15 Thread Jeff Pang
-- file_two but no 3243--file_two. Repeated print statements later on in the job continue to indicate that this is not forking correctly. Try this: use strict; my @files = qw/aa bb cc/; foreach my $file ( @files ) { my $pid = fork(); print $pid -- $file\n; exit 0 unless $pid; } and print

forking doubt

2006-03-14 Thread Saurabh Singhvi
Hi all, my $child = fork (); unless ($child) { sleep 5; print child\n; } print parent\n if $child; print parent2\n if $child; the above code prints the parent lines followed by the child. Now what i want to do is print the parent line1 and then the child followed

Re: forking doubt

2006-03-14 Thread Paul Johnson
On Tue, Mar 14, 2006 at 08:57:03AM +, Saurabh Singhvi wrote: my $child = fork (); unless ($child) { sleep 5; print child\n; } print parent\n if $child; print parent2\n if $child; the above code prints the parent lines followed by the child. Now

Re: forking doubt

2006-03-14 Thread Jeff Pang
It's not so easy to do that. you should use the signal to communicate between childs and parent. -Original Message- From: Saurabh Singhvi [EMAIL PROTECTED] Sent: Mar 14, 2006 3:57 AM To: Perl FAq beginners@perl.org Subject: forking doubt Hi all, my $child = fork (); unless

Re: First-time forking

2006-03-14 Thread Cornelis Swanepoel
Thanks a lot for your replies, I've incorporated the children counter variable, increasing it after every fork, decreasing it after every SIG{CHLD}. However, I still have an unresolved issue, Jay: It's not missing; it was never there. Your parent process dies before its children are finished.

Re: First-time forking

2006-03-14 Thread Jeff Pang
Does that not mean that a parent will stay alive until all children have finished ? No,the parent should get exited when it finish its session,in spite of childs are still running or not. When the parent exit,the childs should be take-overed by system init process,whose process ID is

Re: First-time forking

2006-03-14 Thread Cornelis Swanepoel
Thanks Jeff, That clarifies it. Regards Cornelis --memento mori On 3/14/06, Jeff Pang [EMAIL PROTECTED] wrote: Does that not mean that a parent will stay alive until all children have finished ? No,the parent should get exited when it finish its session,in spite of childs are still

Re: First-time forking

2006-03-14 Thread Jeff Pang
The process's pid is 1 really.It has been take-overed by system init process. Sorry for my mistake,it should be the process's ppid really.ppid just mean 'parent process id'. -- Jeff Pang NetEase AntiSpam Team http://corp.netease.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

First-time forking

2006-03-13 Thread Cornelis Swanepoel
; } Tovid executes successfully for both files but when the encoding is finished the parent process just hangs there. The program is forking the children in parallel as can be seen from the tovid output as well as tail -f log: Simpsons episodes: Simpsons_2 Simpsons_3 Forked child process

Re: First-time forking

2006-03-13 Thread Shawn Corey
Cornelis Swanepoel wrote: The SIG{CHLD} handler doesn't get called since the output from print LOG Child process no. $stiff exited with status $?\n; is missing. It's not missing; it was never there. Your parent process dies before its children are finished. It is no longer around to reap

Re: First-time forking

2006-03-13 Thread Jay Savage
On 3/13/06, Cornelis Swanepoel [EMAIL PROTECTED] wrote: I have found the following text in the perlfork manpage: Calling exec() within a pseudo-process actually spawns the requested executable in a separate process and waits for it to complete before exiting with the same exit status as

First-time forking frustration

2006-03-13 Thread Cornelis Swanepoel
; } $SIG{CHLD} = \REAPER; } Tovid executes successfully for both files but when the encoding is finished the parent process just hangs there. The program is forking the children in parallel as can be seen from the tovid output as well as from tailing log The SIG{CHLD

Re: First-time forking

2006-03-13 Thread Jeff Pang
The SIG{CHLD} handler doesn't get called since the output from print LOG Child process no. $stiff exited with status $?\n; is missing. You can't see the output in your log is because when your childs are executing,your parent has exited. In order to see the callbacking childs,just add this

Re: First-time forking

2006-03-13 Thread Mr. Shawn H. Corey
Jeff Pang wrote: You can't see the output in your log is because when your childs are executing,your parent has exited. In order to see the callbacking childs,just add this line in the code end: sleep while(1); # parent sleep to wait for childs exiting This would be a bad idea since the

Re: First-time forking

2006-03-13 Thread Jeff Pang
This would be a bad idea since the process never exits. En? I just want to show the childs exiting status. Surely,you could modify it simply to get main process exit normally. for example: # you could get the childs numbers by counting the @files array $CHILD_COUNT=N; # defined the sig

CHILD_ERROR and forking within a child

2005-09-07 Thread steve abrams
* code 'paraphrased' for simplicity * Hi all, I have a script which goes to a subroutine. Within the subroutine, there exists: $pid = fork; push(@pids, $pid); unless ($pid) { my $var = new Object; if (not $var-method_that_evokes_a_child()) {Exit;} exit 2; } where the

RE: CHILD_ERROR and forking within a child

2005-09-07 Thread Bob Showalter
steve abrams wrote: * code 'paraphrased' for simplicity * Hi all, I have a script which goes to a subroutine. Within the subroutine, there exists: $pid = fork; push(@pids, $pid); unless ($pid) { my $var = new Object; if (not $var-method_that_evokes_a_child())

DBI + forking (was: DBI + XML::Twig conflict)

2005-06-11 Thread Peter Rabbitson
closes. The natural thing to do for me was to preceed the call of the forking function (namely parseurl) with ++$dbh-{InactiveDestroy} and then add undef $dbh-{InactiveDestroy} as the first line of _dummy(). Worked like a charm since then. Whether or not this works correctly on Windows I

forking

2004-07-09 Thread Michael Gargiullo
I need some assistance. I wrote a script that takes an array of IP addresses, and in a foreach loop uses a subroutine to make a few SNMP connections, and writes results to a flat file.(snipet below) For 1000 IP addresses, it takes 17 minutes. I wonder if there's a way to fork 10-20 (at a time)

Re: forking

2004-07-09 Thread Wiggins d Anconia
I need some assistance. I wrote a script that takes an array of IP addresses, and in a foreach loop uses a subroutine to make a few SNMP connections, and writes results to a flat file.(snipet below) For 1000 IP addresses, it takes 17 minutes. I wonder if there's a way to fork 10-20 (at

POE [WAS:Re: Forking]

2004-03-09 Thread Michael C. Davis
At 11:08 PM 3/8/04 -0500, Wiggins d'Anconia wrote: This is where I do my usual little dance, though untimely as it may be in this case, across the stage and say POE then exit again as if I was still on vacation OK, I'll bite. What's so great about POE, and why, oh, why, do you love it so?

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Wiggins d Anconia
processes and maintain bi-directional communication with them becomes a nightmare of dealing with forking code, pipes, and all of the other IPC nasties. POE::Wheel::Run encapsulates all of that providing a very simple interface for dealing with forking those processes and handling their input/output

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Michael C. Davis
At 08:54 AM 3/9/04 -0700, Wiggins d Anconia wrote: In this case the desire to fork multiple processes and maintain bi-directional communication with them becomes a nightmare of dealing with forking code, pipes, and all of the other IPC nasties. POE::Wheel::Run encapsulates all of that providing

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Wiggins d Anconia
At 08:54 AM 3/9/04 -0700, Wiggins d Anconia wrote: In this case the desire to fork multiple processes and maintain bi-directional communication with them becomes a nightmare of dealing with forking code, pipes, and all of the other IPC nasties. POE::Wheel::Run encapsulates all

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Michael C. Davis
At 09:52 AM 3/9/04 -0700, Wiggins d Anconia wrote: ... a framework for handling time slicing, or event programming tasks, or multi-tasking processes If that's what it is, these terms localize it pretty well for me. An event-based framework for handling time-slicing in multitasking processes. --

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Wiggins d Anconia
At 09:52 AM 3/9/04 -0700, Wiggins d Anconia wrote: ... a framework for handling time slicing, or event programming tasks, or multi-tasking processes If that's what it is, these terms localize it pretty well for me. An event-based framework for handling time-slicing in multitasking

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Michael C. Davis
At 11:32 AM 3/9/04 -0700, Wiggins d Anconia wrote: ... famboozled watchamathingie with xanatically whooziewhatsit on a beginners list ;-)... Oh yeah, since you bring it up about the whooziewhatsit ... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: POE [WAS:Re: Forking]

2004-03-09 Thread Randal L. Schwartz
that I don't get booted off for channel flooding. POE is like forking, without the complete separation of data and troublesome IPC issues. POE is like threads, but with built-in data locking. POE requires some discipline, but can be very powerful when used correctly. -- Randal L. Schwartz

Re: Forking

2004-03-08 Thread Wiggins d'Anconia
Bob Showalter wrote: Price, Jason wrote: Hmm...I guess that's the majority of the script. :) I can follow what it does, but I'm not entirely sure why it does it. Also, is there any way I can self-contain the output from each child process? You can use a separate pipe for each child, but now

Forking

2004-03-03 Thread Price, Jason
Not sure if this is the right list for this - if it's not, please direct me to the proper list. Anyway, I'm trying to get my hands around forking, and was hoping you all could help me out. Basically, I'm trying to find a way to fire off a remote script on numerous boxes in parallel, returning

RE: Forking

2004-03-03 Thread Bob Showalter
Price, Jason wrote: Not sure if this is the right list for this - if it's not, please direct me to the proper list. You've come to the right place. Anyway, I'm trying to get my hands around forking, and was hoping you all could help me out. Basically, I'm trying to find a way to fire off

RE: Forking

2004-03-03 Thread Price, Jason
] Sent: Wednesday, March 03, 2004 1:17 PM To: 'Price, Jason'; '[EMAIL PROTECTED]' Subject: RE: Forking Price, Jason wrote: Not sure if this is the right list for this - if it's not, please direct me to the proper list. You've come to the right place. Anyway, I'm trying to get my hands

Re: Forking

2004-03-03 Thread wolf blaum
-Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 03, 2004 1:17 PM To: 'Price, Jason'; '[EMAIL PROTECTED]' Subject: RE: Forking Price, Jason wrote: Not sure if this is the right list for this - if it's not, please direct me to the proper list. You've

RE: Forking

2004-03-03 Thread Bob Showalter
already exited (otherwise the loop wouldn't have exited.) You might want the exit statuses or not. You can also usually use $SIG{CHLD} = 'IGNORE' prior to the forking loop if you don't care about exit statuses. see perldoc perlipc Hmm...I guess that's the majority of the script. :) I can follow

Re: Forking

2004-03-03 Thread wolf blaum
statuses or not. You can also usually use $SIG{CHLD} = 'IGNORE' prior to the forking loop if you don't care about exit statuses. see perldoc perlipc Uh, I appologize - anyway, could you explain that last part to me? Do you create zombies if you dont handle the exit status of you child by either

RE: Forking

2004-03-03 Thread Bob Showalter
.) You might want the exit statuses or not. You can also usually use $SIG{CHLD} = 'IGNORE' prior to the forking loop if you don't care about exit statuses. see perldoc perlipc Uh, I appologize - anyway, could you explain that last part to me? Do you create zombies if you dont handle the exit

Problems forking -- fork DOSes my comp

2003-12-10 Thread Dan Anderson
I am learning about forks, so I tried the following code to make sure I had everything down: #! /usr/bin/perl use strict; use warnings; my $counter = 1; my $pid = 0; while ($counter 50) { if ($pid = fork) { open (FORKED, ./fork/$counter) or die(COULD NOT OPEN FORK); print

Problems forking -- fork DOSes my comp

2003-12-10 Thread Robert Brown
Dan Anderson writes: I am learning about forks, so I tried the following code to make sure I had everything down: #! /usr/bin/perl use strict; use warnings; my $counter = 1; my $pid = 0; while ($counter 50) { if ($pid = fork) { open (FORKED, ./fork/$counter)

Re: Problems forking -- fork DOSes my comp

2003-12-10 Thread James Edward Gray II
On Dec 10, 2003, at 3:52 PM, Dan Anderson wrote: I am learning about forks, so I tried the following code to make sure I had everything down: Still don't believe me about Network Programming with Perl, eh? Did I mention that it covers forking well? laughs Basic idea of fork: if ($pid = fork

Re: Problems forking -- fork DOSes my comp

2003-12-10 Thread Dan Anderson
that it covers forking well? laughs LOL. Thanks for all your help. I actually put a copy on my Safari bookshelf but I have yet to start it. -Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response

Re: Problems forking -- fork DOSes my comp

2003-12-10 Thread david
(COULD NOT OPEN FORK); print FORKED $counter; close(FORKED); $SIG{CHLD} = IGNORE; } $counter++; } [snip] So what am I doing wrong? you are forking a lot more child than you think! what you essentially have is: start with 1 process, fork: parent process

  1   2   >