marcelser has asked for the wisdom of the Perl Monks concerning the following question:
Maybe also interesting is that I use Log4Perl to print DEBUG messages to logfile. Here's what it looks like when it stops in the middle of nowhere.# config my $avg1_limit = '4.0'; my $avg5_limit = '2.0'; sub check_load { DEBUG("Enabling Auto Backtrace with output directory: '" . $tmp_dir +. "'"); Debug::FaultAutoBT->new(dir => "$tmp_dir")->ready; my $current_dir = getcwd; DEBUG("check load is running from directory: '" . $current_dir . "'" +); my @avgs = loadavg(); my $load = { avg_1 => $avgs[LOADAVG_1MIN], avg_5 => $avgs[LOADAVG_5M +IN], avg_15 => $avgs[LOADAVG_15MIN] }; my $dumper = Data::Dumper->new([$load],[qw($load)]); DEBUG("current system load is: " . $dumper->Dump()); INFO("waiting for loads to drop below '1 min=$avg1_limit, 5 min=$avg +5_limit'"); eval { while ($load->{'avg_1'} > $avg1_limit or $load->{'avg_5'} > +$avg5_limit) { sleep(5); DEBUG('about to call "loadavg"'); @avgs = loadavg(); $load = { avg_1 => $avgs[LOADAVG_1MIN], avg_5 => $avgs[LOA +DAVG_5MIN], avg_15 => $avgs[LOADAVG_15MIN] }; DEBUG("... re-ckeck system load: " . $dumper->Dump()); } }; if ($@) { ERROR "failed checking load, error: $@"; } else { DEBUG "while loop ended nicely"; } INFO("finished waiting, system load is now: " . Data::Dumper->Dump([ +$load],[qw($load)])); }
What's puzzling me here actuall is the 2nd and following print of the Dumper so the lines starting with "... re-check system load" which pints just $load = $load instead of $load = { .... } but even without this message the script just stops here dead in its tracks without triggerint Debug::FaultAutoBT or producing a coredump. I'm trying to figure why this isn't working since weeks now and I'm really out of ideas. Maybe it has to do with the fact that it's forked background process or that it repeatedly calls loadavg but I think it must be something else. Any help is greatly appreciated cause I'm really starting to question perl here greatly. I've actually 10+ year of pressional perl experience but I never encountered a think like this...2019/10/24 04:56:21 DEBUG [29280] Enabling Auto Backtrace with output +directory: '/tmp/cores' 2019/10/24 04:56:21 DEBUG [29280] check load is running from directory +: '/' 2019/10/24 04:56:21 DEBUG [29280] current system load is: $load = { 'avg_5' => '2.34', 'avg_1' => '2.31', 'avg_15' => '2.28' }; 2019/10/24 04:56:21 INFO [29280] waiting for loads to drop below '1 mi +n=4.0, 5 min=2.0' 2019/10/24 04:56:26 DEBUG [29280] about to call "loadavg" 2019/10/24 04:56:26 DEBUG [29280] ... re-ckeck system load: $load = $l +oad; 2019/10/24 04:56:31 DEBUG [29280] about to call "loadavg" 2019/10/24 04:56:31 DEBUG [29280] ... re-ckeck system load: $load = $l +oad;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: forked process silently dies without coredump. No clue what's going on (updated)
by haukex (Archbishop) on Oct 27, 2019 at 12:41 UTC | |
|
Re: forked process silently dies without coredump. No clue what's going on
by jcb (Parson) on Oct 28, 2019 at 00:15 UTC | |
by marcelser (Initiate) on Oct 31, 2019 at 12:08 UTC | |
by jcb (Parson) on Nov 01, 2019 at 03:48 UTC | |
|
Re: forked process silently dies without coredump. No clue what's going on
by Anonymous Monk on Oct 27, 2019 at 12:44 UTC | |
by marcelser (Initiate) on Oct 31, 2019 at 12:10 UTC | |
by Anonymous Monk on Oct 31, 2019 at 12:25 UTC |