Opened 2 years ago

Last modified 17 months ago

#1219 new defect

Can't use an undefined value as an ARRAY reference in HTMLOld.pm

Reported by: alec Owned by: nobody
Priority: normal Milestone: Munin 2.0.0
Component: web-interface Version: devel
Severity: blocker Keywords:
Cc:

Description

Just spent a while setting up rc6, only to get this error when trying to view the web interface:

Can't use an undefined value as an ARRAY reference at /usr/local/share/perl/5.14.2/Munin/Master/HTMLOld.pm line 656.

My perl's a little rusty but it seems $htmlconfig is never being filled.

Change History (10)

comment:1 Changed 2 years ago by NicoHaase

Same here. Munin is no longer running after installing it through squeeze-backports on my debian server :(

comment:2 Changed 2 years ago by valdezjoelt

same here i'm having the same error

comment:3 Changed 2 years ago by valdezjoelt

is there any workaround for this?

comment:4 Changed 2 years ago by jesusch

Same here for me
I even tried to port munin-2.0.1 to the debian-squeeze-backport
still the same error

comment:5 Changed 2 years ago by jesusch

alec is quite right

I put this within the HTMLOld.pm (at line 647)

use Data::Dumper;
print Dumper($htmlconfig);

which results in $VAR1 = undef;

comment:6 Changed 2 years ago by ndonegan

Confirmed on Wheezy also. I also got a stack trace of what's going on:

munin@host:~$ /usr/share/munin/munin-html
not a reference at /usr/share/perl5/Munin/Master/Utils.pm line 908
munin@host:~$ perl -MCarp::Always /usr/share/munin/munin-html
not a reference at /usr/lib/perl/5.14/Storable.pm line 38
	Storable::__ANON__('not a reference') called at /usr/lib/perl/5.14/Storable.pm line 236
	Storable::_store('CODE(0x15e6e80)', undef, '/var/lib/munin/htmlconf.storable.tmp.24453', 0) called at /usr/lib/perl/5.14/Storable.pm line 210
	Storable::nstore(undef, '/var/lib/munin/htmlconf.storable.tmp.24453') called at /usr/share/perl5/Munin/Master/Utils.pm line 908
	Munin::Master::Utils::munin_write_storable('/var/lib/munin/htmlconf.storable', undef) called at /usr/share/perl5/Munin/Master/Utils.pm line 921
	Munin::Master::Utils::munin_writeconfig_storable('/var/lib/munin/htmlconf.storable', undef) called at /usr/share/perl5/Munin/Master/HTMLOld.pm line 183
	Munin::Master::HTMLOld::html_main() called at /usr/lib/perl/5.14/Storable.pm line 38
	Storable::__ANON__('not a reference') called at /usr/lib/perl/5.14/Storable.pm line 236
	Storable::_store('CODE(0x15e6e80)', undef, '/var/lib/munin/htmlconf.storable.tmp.24453', 0) called at /usr/lib/perl/5.14/Storable.pm line 210
	Storable::nstore(undef, '/var/lib/munin/htmlconf.storable.tmp.24453') called at /usr/share/perl5/Munin/Master/Utils.pm line 908
	Munin::Master::Utils::munin_write_storable('/var/lib/munin/htmlconf.storable', undef) called at /usr/share/perl5/Munin/Master/Utils.pm line 921
	Munin::Master::Utils::munin_writeconfig_storable('/var/lib/munin/htmlconf.storable', undef) called at /usr/share/perl5/Munin/Master/HTMLOld.pm line 183
	Munin::Master::HTMLOld::html_main() called at /usr/share/munin/munin-html line 38

From a quick glance I'm guessing that line 182 in /usr/share/perl5/Munin/Master/HTMLOld.pm, which is simply get_config(0), should be doing something more, but I haven't dug any deeper just yet.

comment:7 Changed 2 years ago by saily

i have a similar issue after installing Munin 2.0.7.
Try to run through Apache 2.2.15 (fcgi) on CentOS release 6.2.

Can't use an undefined value as an ARRAY reference at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 692.

Command line:

[root@host ~]# sudo -u munin /usr/share/munin/munin-html 
not a reference at /usr/share/perl5/vendor_perl/Munin/Master/Utils.pm line 947

munin-graph seems to work fine.

comment:8 Changed 2 years ago by saily

Stack trace of what's going on:

[root@host ~]# sudo -u munin perl -MCarp::Always /usr/share/munin/munin-html
not a reference at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/logcroak.al) line 76
	Storable::logcroak('not a reference') called at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/_store.al) line 244
	Storable::_store('CODE(0x19b4dc0)', undef, '/var/lib/munin/htmlconf.storable.tmp.16718', 0) called at ../../lib/Storable.pm (autosplit into ../../lib/auto/Storable/nstore.al) line 218
	Storable::nstore(undef, '/var/lib/munin/htmlconf.storable.tmp.16718') called at /usr/share/perl5/vendor_perl/Munin/Master/Utils.pm line 947
	Munin::Master::Utils::munin_write_storable('/var/lib/munin/htmlconf.storable', undef) called at /usr/share/perl5/vendor_perl/Munin/Master/Utils.pm line 961
	Munin::Master::Utils::munin_writeconfig_storable('/var/lib/munin/htmlconf.storable', undef) called at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 181
	Munin::Master::HTMLOld::get_config(0) called at /usr/share/perl5/vendor_perl/Munin/Master/HTMLOld.pm line 191
	Munin::Master::HTMLOld::html_main() called at /usr/share/munin/munin-html line 38

comment:9 Changed 22 months ago by jlopez

After some debugging comparing with a working version, the origin is at /usr/share/perl5/Munin/Master/Utils.pm:1034:

my $data    = munin_readconfig("$config->{dbdir}/datafile", 1, 1);

Stack trace:

  DB<2> T
$ = Munin::Master::Utils::munin_config('/etc/munin/munin.conf', undef) called from file `/usr/share/perl5/Munin/Master/HTMLOld.pm' line 137
. = Munin::Master::HTMLOld::html_startup(ref(ARRAY)) called from file `/usr/lib/munin/cgi/munin-cgi-html' line 53

This HASH has lots of differences compared to the working version.

I fixed this with:

$ rm -f /var/lib/munin/{datafile,datafile.storable,htmlconf.storable}

Those files are rewritten by munin-update and munin-html if there is at least one node to fetch data from.

You can run this as munin user to verify it works:

$ munin-cron --debug

On failure, try manually connecting to a node and check firewall and allow/cidr_allow munin-node configuration directives.

comment:10 Changed 17 months ago by olof

I also have this issue on the debian wheezy version (2.0.6-3); removing the
generated files as suggested by jopez doesn't work.

What I've seen is that Munin::Master::HTMLConfig::get_group_tree (as called by
generate_config() from get_config()) returns undef if $visible isn't true.

# line 169
push( @$groups, grep {defined $_} get_group_tree($child, $base.munin_get_node_name($child) . "/"));

if (scalar @$groups) {
    $visible = 1;
}

.....

# line 182
return unless $visible;

But calling code does not handle the case where undef is returned, making
$htmlconfig be undef, which in turn makes nstore() die with "not a reference"
message.

Note: See TracTickets for help on using tickets.