View | Details | Raw Unified | Return to bug 4594
Collapse All | Expand All

(-)lib/Mail/SpamAssassin/SpamdForkScaling.pm (-3 / +17 lines)
Lines 426-432 Link Here
426
    dbg("prefork: ordered $kid to accept");
426
    dbg("prefork: ordered $kid to accept");
427
427
428
    # now wait for it to say it's done that
428
    # now wait for it to say it's done that
429
    return $self->wait_for_child_to_accept($sock);
429
    my $ret = $self->wait_for_child_to_accept($kid, $sock);
430
    if ($ret) {
431
      return $ret;
432
    } else {
433
      # retry with another child
434
      return $self->order_idle_child_to_accept();
435
    }
430
436
431
  }
437
  }
432
  else {
438
  else {
Lines 436-445 Link Here
436
}
442
}
437
443
438
sub wait_for_child_to_accept {
444
sub wait_for_child_to_accept {
439
  my ($self, $sock) = @_;
445
  my ($self, $kid, $sock) = @_;
440
446
441
  while (1) {
447
  while (1) {
442
    my $state = $self->read_one_message_from_child_socket($sock);
448
    my $state = $self->read_one_message_from_child_socket($sock);
449
443
    if ($state == PFSTATE_BUSY) {
450
    if ($state == PFSTATE_BUSY) {
444
      return 1;     # 1 == success
451
      return 1;     # 1 == success
445
    }
452
    }
Lines 447-453 Link Here
447
      return undef;
454
      return undef;
448
    }
455
    }
449
    else {
456
    else {
450
      die "prefork: ordered child to accept, but child reported state '$state'";
457
      warn "prefork: ordered child $kid to accept, but they reported state '$state', killing rogue";
458
      $self->child_error_kill($kid, $sock);
459
      $self->adapt_num_children();
460
      sleep 1;
461
462
      return undef;
451
    }
463
    }
452
  }
464
  }
453
}
465
}
Lines 479-484 Link Here
479
491
480
sub update_child_status_busy {
492
sub update_child_status_busy {
481
  my ($self) = @_;
493
  my ($self) = @_;
494
495
# if (rand 4 < 1) { $self->report_backchannel_socket("I".pack("N",$self->{pid})."\n");return; warn "TEST for bug 4594"; die; }
482
  # "B  b1 b2 b3 b4 \n "
496
  # "B  b1 b2 b3 b4 \n "
483
  $self->report_backchannel_socket("B".pack("N",$self->{pid})."\n");
497
  $self->report_backchannel_socket("B".pack("N",$self->{pid})."\n");
484
}
498
}

Return to bug 4594