Subject: | oodles of apache log warnings |
I set up a kwiki and am seeing lots of warnings in my Apache log when I refresh the home page. This makes it very difficult to use the log. The problem is also seen by other users. The messages look like this:
[Thu Nov 17 13:01:46 2005] index.cgi: \t(in cleanup) Can't call method
"unhook" on an undefined value
at /usr/lib/perl5/site_perl/5.8.6/Spoon/Hub.pm line 109 during global
destruction.
[Thu Nov 17 13:01:46 2005] index.cgi:
at /usr/lib/perl5/site_perl/5.8.6/Spoon/Base.pm line 110
[Thu Nov 17 13:01:46 2005] index.cgi: \tSpoon::Base::__ANON__('Can\\'t
call method "unhook" on an undefined value at /usr/lib...') called
at /usr/lib/perl5/site_perl/5.8.6/Spoon/Hub.pm line 109
[Thu Nov 17 13:01:46 2005] index.cgi:
\tSpoon::Hub::remove_hooks('Kwiki::Hub=HASH(0x848af48)') called
at /usr/lib/perl5/site_perl/5.8.6/Spoon/Hub.pm line 119
[Thu Nov 17 13:01:46 2005] index.cgi:
\tSpoon::Hub::DESTROY('Kwiki::Hub=HASH(0x848af48)') called
at /srv/www/kwiki/index.cgi line 0
[Thu Nov 17 13:01:46 2005] index.cgi: \teval {...} called
at /srv/www/kwiki/index.cgi line 0
http://www.kwiki.org/?BugReports says:
Kwiki plugins that add hooks, e.g. `Kwiki::Archive::Rcs 0.15` and
`Kwiki:: PagePrivacy 0.10`, cause the following errors to appear in my
Apache error log:
[error] index.cgi: \t(in cleanup) Can't call method "unhook" on an undefined value at /usr/pkg/lib/perl5/site_perl/5.8.6/Spoon/Hub.pm line 109 during global destruction., referer: http://wiki.example.com/
Removing those plugins from the kwiki makes these errors go away. The
plugins still work as expected, meaning the hooks are active when
index.cgi is executed, but it appears these errors are generated when
the index.cgi script is cleaning up after itself.
When using thttpd, the errors go to the browser instead, making this a
user-visible bug.
Workaround: After doing a `wiki -update`, manually change the first line
of `index.cgi` to:
#!/usr/bin/perl
I don't like that solution much (i.e. removing -w from the first line)
so I thought I'd dig a little deeper. A little delving shows me that
$self->all_hooks is returning an ARRAY with three undef elements in
Spoon::Hub::remove_hooks:
sub remove_hooks {
my $hooks = $self->all_hooks;
while (@$hooks) {
pop(@$hooks)->unhook;
}
}
I changed the code to:
sub remove_hooks {
my $hooks = $self->all_hooks;
while (@$hooks) {
my $hook = pop @$hooks;
$hook->unhook if $hook;
}
}
This fixes the problem and does not break the install tests.
HTH, Dave
Oh, SuSE 9.3 on a regular Intel box