sub run {
my ($class, %args) = @_;
log_trace { "run() has been invoked on remote node" };
-
- if ($args{watchdog_timeout}) {
- Object::Remote::WatchDog->new(timeout => $args{watchdog_timeout});
- }
-
+
my $c = Object::Remote::Connector::STDIO->new->connect;
$c->register_class_call_handler;
print { $c->send_to_fh } "Shere\n";
log_debug { "Node is going to start the run loop" };
+ if ($args{watchdog_timeout}) {
+ Object::Remote::WatchDog->new(timeout => $args{watchdog_timeout});
+ } else {
+ #reset connection watchdog from the fatnode
+ alarm(0);
+ }
$loop->want_run;
$loop->run_while_wanted;
log_debug { "Run loop invocation in node has completed" };
requires '_open2_for';
-has timeout => (is => 'ro', default => sub { { after => 10 } });
+has timeout => (is => 'ro', default => sub { 10 });
sub connect {
my $self = shift;
log_trace { "initialized events on channel for child pid '$child_pid'; creating timeout" };
Object::Remote->current_loop
->watch_time(
- %{$self->timeout},
+ after => $self->timeout,
code => sub {
Dlog_trace { "Connection timeout timer has fired for child pid '$child_pid'; is_ready: $_" } $f->is_ready;
unless($f->is_ready) {
sub fatnode_text {
my ($self) = @_;
+ my $connection_timeout = $self->timeout;
+ my $watchdog_timeout = $self->watchdog_timeout;
my $text = '';
require Object::Remote::FatNode;
- if (defined($self->watchdog_timeout)) {
- $text = "my \$WATCHDOG_TIMEOUT = '" . $self->watchdog_timeout . "';\n";
- $text .= "alarm(\$WATCHDOG_TIMEOUT);\n";
+ if (defined($connection_timeout)) {
+ $text .= "alarm($connection_timeout);\n";
+ }
+
+ if (defined($watchdog_timeout)) {
+ $text .= "my \$WATCHDOG_TIMEOUT = $watchdog_timeout;\n";
} else {
- $text = "my \$WATCHDOG_TIMEOUT = undef;\n";
+ $text .= "my \$WATCHDOG_TIMEOUT = undef;\n";
}
$text .= <<'END';
open(my $nullfh, '>', '/dev/null') or die "Could not open /dev/null: $!";
-my $fatnode_text = Object::Remote::Connector::Local->new(watchdog_timeout => 1)->fatnode_text;
+my $fatnode_text = Object::Remote::Connector::Local->new(timeout => 1)->fatnode_text;
#this simulates a node that has hung before it reaches
#the watchdog initialization - it's an edge case that