in reply to Re: Nested forks -help!
in thread Nested forks -help!

you're right, the exit call at customer level is wrong, it should be at the end of the
if ($cust_pid == 0) {
}
section. And this is where it is in my application. Sorry for not spotting the typo in my message before submitting it.
I need multiple customers running at the same time so I can't wait for the child to finish unfortunately.

What I mean by "Perl seems to be confusing...." is that the Net::SNMP module starts giving me strange errors in the form of "No response from Agent on router" and "Sent pid is not the same as the one received", whereas when I omit forking at customer level, I do not get any errors at all.

I read somewhere that SIGCHLD is not very reliable with Perl and that race conditions could occur. Can it be just that the source of my problem?

Replies are listed 'Best First'.
Re: Re: Re: Nested forks -help!
by ariels (Curate) on Jul 24, 2001 at 11:07 UTC
    Unfortunately I'm unfamiliar with the Net::SNMP module and the SNMP protocol, so I shan't be able to help much.

    I read somewhere that SIGCHLD is not very reliable with Perl and that race conditions could occur. Can it be just that the source of my problem?
    Not if $SIG{CHLD} is indeed set to 'IGNORE' in your program.

    One possibility for getting into troubl with multiple processes is to try to use them same socket with all of them. This will probably happen if you create your Net::SNMP session in advance for all your children and try to use it from all of them; either create a separate object in each (leaf!) child or put all uses of the session inside mutexes.