in reply to forked process silently dies without coredump. No clue what's going on
Your logging code is also broken. You are constructing an anonymous hash on line 11 to hold the load average information and storing a reference to that hash. You then store a new hash into the $load lexical on line 22, but the $dumper object still has a reference to the hash that was built on line 11, and will dump that hash again and again, with the old data. Line 32 correctly uses the latest information.
Either change line 22 to a slice assignment: (untested)
@{$load}{qw/avg_1 avg_5 avg_15/} = @avgs[LOADAVG_1MIN, LOADAVG_5MIN, L +OADAVG_15MIN];
... which will actually change the hash that $dumper knows about. (Also call $dumper->Reset as another monk mentioned.) Or use the same approach on line 23 as you use on line 32.
No idea why your program is bailing out; do you perhaps have a $SIG{__DIE__} handler active while this code is running that could be calling exit?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: forked process silently dies without coredump. No clue what's going on
by marcelser (Initiate) on Oct 31, 2019 at 12:08 UTC | |
by jcb (Parson) on Nov 01, 2019 at 03:48 UTC |