Item11948: ModPerlEngineContrib sometimes 'Can't locate object method "stringify" via package "APR::Error"'
Priority: Normal
Current State: Closed
Released In: 1.1.6
Target Release: patch
We encountered a foswiki error message in our apache server log:
[error] Can't locate object method "stringify" via package "APR::Error" at …/foswiki/lib/Foswiki/Engine.pm line 103.
You can look at the
line in question in the trac source code browser. The
documentation for APR::Error does not state any such method. It looks as if foswiki was making too many assumptions about the kind of exception it might encounter at that location, and didn't expect
APR::Error
. The reason for this exception might have been some problem reading data for a file upload, due to TCP breakdown or browser issues. But no matter the cause, the exception handler should be able to handle all its exceptions.
--
MartinVonGagern - 14 Jun 2012
Hi Martin, your analysis seems to be correct. Can you tell us if you are using
ModPerlEngineContrib or
FastCGIEngineContrib? Also: are you in a position to test a fix?
--
PaulHarvey - 16 Jun 2012
Here is the Release01x01 diff of
Engine.pm
against Foswiki 1.1.5:
diff --git a/lib/Foswiki/Engine.pm b/lib/Foswiki/Engine.pm
index c465bfe..929cee8 100644
--- a/lib/Foswiki/Engine.pm
+++ b/lib/Foswiki/Engine.pm
@@ -93,14 +93,17 @@ sub prepare {
otherwise {
my $e = shift;
my $res = Foswiki::Response->new();
+ my $mess =
+ $e->can('stringify')
+ ? $e->stringify()
+ : 'Unknown ' . ref($e) . ' exception: ' . $@;
$res->header( -type => 'text/plain' );
if (DEBUG) {
# output the full message and stacktrace to the browser
- $res->print( $e->stringify() );
+ $res->print($mess);
}
else {
- my $mess = $e->stringify();
print STDERR $mess;
# tell the browser where to look for more help
Or download
http://svn.foswiki.org/branches/Release01x01/core/lib/Foswiki/Engine.pm
Do so at your own risk...
Foswiki 1.1.5 Engine.pm in case you need to restore it (make a backup first). Preferably try this in a testing environment where you can safely reproduce the problem.
--
PaulHarvey - 16 Jun 2012
I see neither
ModPerlEngineContrib nor
FastCGIEngineContrib installed on that setup.
I haven't tried reproducing this issue yet, and as the request causing the original error message didn't originate on my system, and appeared to have some browser-dependent aspect to it as well, I'm not sure how easily this can be reproduced. Will check that.
If I can reproduce it, I'll try set up a testing system, reproduce there as well, and then see about the error message. Might take a while.
--
MartinVonGagern - 16 Jun 2012
I couldn't reproduce this issue, but when I generate such an exception artificially, the error message looks better: "Unknown APR::Error exception" followed by the stringized content of that exception. So everything looks nice enough here. Sorry it took me so long to answer this, but I didn't feel like experimenting on our production system, and setting up a suitable test system took some time.
--
MartinVonGagern - 05 Sep 2012
That is extremely helpful nonetheless. Thanks for getting back to us!
--
PaulHarvey - 26 Sep 2012