Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8618841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:12:02+00:00 2026-06-12T06:12:02+00:00

My error is as follows Cannot start another process while you are in the

  • 0

My error is as follows

Cannot start another process while you are in the child process at /usr/lib/perl5/site_perl/5.8.6/Parallel/ForkManager.pm line 463.

The part of my code that is having issues is below, below my code is the sub routine thats failing in forkmanager, I cannot figure out why. Without forkmanager I can run just fine.

my $pm = new Parallel::ForkManager($MAX_PROCESSES);
for (0..$SCOUNT)
{
my $pid = $pm->start and next;
    my %shash = ();
    %shash =
    (   ID      => "$SREF->[$_]->[0]",
        typeID  => "$SREF->[$_]->[1]",
        extIP   => "$SREF->[$_]->[2]",
        intIP   => "$SREF->[$_]->[3]",
        NAME    => "$SREF->[$_]->[4]",
        buTYPE  => "NULL"
    );
    if ($shash{typeID} =~ /^(4|16|17|25|27|28|42|49|50|51|54|58|60|63|19)$/){$shash{buTYPE} = 'LINUX DEDICATED';}
    if ($shash{typeID} =~ /^(11|14|22|32|34|36|37|46)$/)                    {$shash{buTYPE} = 'LINUX FULL';}
    if ($shash{typeID} =~ /^(44)$/)                                         {$shash{buTYPE} = 'EMAIL MARKETER';}
    if ($shash{typeID} =~ /^(43)$/)                                         {$shash{buTYPE} = 'TYip1';}
    if ($shash{typeID} =~ /^(45)$/)                                         {$shash{buTYPE} = 'DDDOMAINS';}
    if ($shash{typeID} =~ /^(56)$/)                                         {$shash{buTYPE} = 'AT MAIL';}
    if ($shash{typeID} =~ /^(65|66)$/)                                      {$shash{buTYPE} = 'ENT MAIL';}
    if ($shash{typeID} =~ /^(1|3)$/)                                        {$shash{buTYPE} = 'LINUX PROD';}

    if ($shash{buTYPE} eq 'LINUX DEDICATED' || $shash{buTYPE} eq 'LINUX FULL')
    #if ($shash{buTYPE} eq 'LINUX FULL')
    {
        next if (`grep $shash{NAME} $excludes`);
        my $ip;
        my $ipchoice=0;
        print "Doing $shash{NAME}.\n";
        my $testport = testport("$shash{intIP}",'1500');
        if(!$testport)
        {
            $ipchoice=1;
            $testport = testport("$shash{extIP}",'1500');
        }
        unless ($testport)
        {
            log_event("$log/rsync_error.$date_string","Port 1500 closed for $shash{NAME}\n");
            next;
        }
        if ($ipchoice==0)
        {   $ip = $shash{intIP};
        }else{
            $ip = $shash{extIP};
        }
#       send_file("$repo/rsyncd.conf","$shash{intIP}","/etc/rsyncd.conf");
        check_rsync($shash{NAME},$ip);
#       do_backup($shash{NAME},$ip,$shash{buTYPE});
    }
    $pm->finish;
}
$pm->wait_all_children;

ForkManager.pm coding.

sub start { my ($s,$identification)=@_;
  die "Cannot start another process while you are in the child process"
    if $s->{in_child};
  while ($s->{max_proc} && ( keys %{ $s->{processes} } ) >= $s->{max_proc}) {
    $s->on_wait;
    $s->wait_one_child(defined $s->{on_wait_period} ? &WNOHANG : undef);
  };
  $s->wait_children;
  if ($s->{max_proc}) {
    my $pid=fork();
    die "Cannot fork: $!" if !defined $pid;
    if ($pid) {
      $s->{processes}->{$pid}=$identification;
      $s->on_start($pid,$identification);
    } else {
      $s->{in_child}=1 if !$pid;
    }
    return $pid;
  } else {
    $s->{processes}->{$$}=$identification;
    $s->on_start($$,$identification);
    return 0; # Simulating the child which returns 0
  }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:12:03+00:00Added an answer on June 12, 2026 at 6:12 am

    You’re calling next inside the child-process code. That attempts to perform the next iteration of for(0..$COUNT), which then tries to fork again, which is not what you want.

    You probably want to change

        next if (`grep $shash{NAME} $excludes`);
    

    to

        $pm->finish if (`grep $shash{NAME} $excludes`);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have define variable error in struts.properties as follows: error=this is an error Now
Code is as follows but I get a ytplayer is not defined error. Is
when I start my JS file, I get the follow error: Charon:modules Modius$ node
Hallo, I cannot compile my project using an ant build script. The error message:
When I try to use QJson library application cannot even start. I get message
The error I'm getting with the thinking-sphinx 2.1.0 gem is: Sphinx cannot be found
I'm receiving the following error while using the NServiceBus 3.0.0 beta 2 pre-release object
I stumbled upon a strange error C2440: '' : cannot convert from '_CR' to
I have a code for jta transcations as follows: try{ //start jta user transcation
When i am running the application,i got an error as follows: Microsoft JScript runtime

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.