diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 505d40c5..500616c4 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -20394,8 +20394,10 @@ sub _test_access } # Check using ping. Returns '1' on success, '0' on fail. + alarm(10); my $connected = $anvil->data->{cache}{database_handle}{$uuid}->ping(); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { connected => $connected }}); + alarm(0); if (not $connected) { $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0192", variables => { server => $say_server }}); diff --git a/Anvil/Tools/Remote.pm b/Anvil/Tools/Remote.pm index 4a1740f7..ff804d48 100644 --- a/Anvil/Tools/Remote.pm +++ b/Anvil/Tools/Remote.pm @@ -510,6 +510,7 @@ sub call 's3:remote_user' => $remote_user, 's4:port' => $port, }}); + alarm(10); ($connect_output) = capture_merged { $ssh_fh = Net::OpenSSH->new($target, user => $remote_user, @@ -525,6 +526,7 @@ sub call 's2:ssh_fh->error' => $ssh_fh->error, 's3:connect_output' => $connect_output, }}); + alarm(0); # Any fatal issues reaching the target? if ($connect_output =~ /Could not resolve hostname/i) @@ -703,10 +705,12 @@ sub call $error = ""; if ($timeout) { - # Call with a timeout + # Call with a timeout. Use alarm also, as capture2's timeout is questionaly reliable. + alarm($timeout + 2); ($output, $error) = $ssh_fh->capture2({timeout => $timeout}, $shell_call); $output = "" if not defined $output; $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, secure => $secure, list => { 'ssh_fh->error' => $ssh_fh->error }}); + alarm(0); } else { diff --git a/tools/scancore b/tools/scancore index 82743b38..6d2367df 100755 --- a/tools/scancore +++ b/tools/scancore @@ -144,6 +144,9 @@ while(1) # Do we have at least one database? my $agent_runtime = 0; + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { + "sys::database::connections" => $anvil->data->{sys}{database}{connections}, + }}); if ($anvil->data->{sys}{database}{connections}) { # Run the normal tasks