Item11188: Internal Server Error on DBCALL

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: DBCachePlugin
Branches:
Reported By: OliverSchaub
Waiting For: Main.MichaelDaum
Last Change By: OliverSchaub
Latest Version (2.00) of SetVariablePlugin causes certain DBCALL calls to fail with an internal Server Error:

"$percntDBCALL{\"$2.$3->RenderIndexItem\"}$percnt"

A Rollback to Version 1.02 solved the Problem.

-- OliverSchaub - 20 Oct 2011

Could you please provide a bit more info to this bug report?

-- MichaelDaum - 20 Oct 2011

We have a Topic with the following Code:
%MAKEINDEX{
  "%DBQUERY{
    order="modified"
    reverse="on"
    limit="14"
    exclude="^(WebChanges|WebPreferences|WebTopicLinks|WebIndex|WebNotify|WebHome|WebTagCloud|WebLinks)"
    format="$expand(topWictitle);$web;$topic$n"
  }%"
  pattern="(.*);(.*);(.*)"
  split="\n"
  format="$percntD BCALL{\"$2.$3->RenderIndexItem\"}$percnt"
  group=""
  cols="2"
  sort="off"
}%
(I had to put a "space" here in DBCALL otherwise it gets executed even inside verbatim...)

If you save this Topic you'll get an Internal Server Error. Output from the Logfile:
FastCGI: server "/path/to/wiki/bin/foswiki.fcgi" stderr: Can't call method "fastget" on an undefined value at /path/to/wiki/lib/Foswiki/Plugins/DBCachePlugin/Core.pm line 477., referer: https://our.server.ch/foswiki113x/bin/edit/NameOfTheWeb/WebHomeCopy?t=1319105898
[Thu Oct 20 12:21:25 2011] [error] [client 129.129.194.73] FastCGI: incomplete headers (0 bytes) received from server "/path/to/wiki/bin/foswiki.fcgi", referer: https://our.server.ch/foswiki113x/bin/edit/NameOfTheWeb/WebHomeCopy?t=1319105898

-- OliverSchaub - 20 Oct 2011

Try this patch:

--- lib/Foswiki/Plugins/DBCachePlugin/Core.pm   (revision 12810)
+++ lib/Foswiki/Plugins/DBCachePlugin/Core.pm   (working copy)
@@ -262,6 +262,7 @@
   $theSkip = 0 if $theSkip < 0;
 
   my $theDB = getDB($thisWeb);
+  return '' unless $theDB;
 
   # flag the current web we evaluate this query in, used by web-specific operators
   $dbQueryCurrentWeb = $thisWeb;
@@ -351,6 +352,10 @@
 
   # get form object
   my $baseDB = getDB($thisWeb);
+  unless ($baseDB) {
+    print STDERR "can't get dbcache for '$thisWeb'\n";
+    return undef;
+  }
 
   #writeDebug("1");
 
@@ -452,7 +457,7 @@
       # last resort: lookup the method in the Applications web
       #writeDebug("last resort check for Applications.$thisTopic");
       my $appDB = getDB('Applications');
-      if ($appDB->fastget($thisTopic)) {
+      if ($appDB && $appDB->fastget($thisTopic)) {

-- MichaelDaum - 20 Oct 2011

I applied the Patch but get the same Error-Messages...

-- OliverSchaub - 21 Oct 2011

Any chance of a traceback?

-- MichaelDaum - 22 Oct 2011

I attached a more detailed Log-Entry...

-- OliverSchaub - 24 Oct 2011

Here's another patch that adds an extra check for web existence:

Index: lib/Foswiki/Plugins/DBCachePlugin/Core.pm
===================================================================
--- lib/Foswiki/Plugins/DBCachePlugin/Core.pm   (revision 12865)
+++ lib/Foswiki/Plugins/DBCachePlugin/Core.pm   (working copy)
@@ -262,6 +262,7 @@
   $theSkip = 0 if $theSkip < 0;
 
   my $theDB = getDB($thisWeb);
+  return '' unless $theDB;
 
   # flag the current web we evaluate this query in, used by web-specific operators
   $dbQueryCurrentWeb = $thisWeb;
@@ -351,6 +352,10 @@
 
   # get form object
   my $baseDB = getDB($thisWeb);
+  unless ($baseDB) {
+    print STDERR "can't get dbcache for '$thisWeb'\n";
+    return undef;
+  }
 
   #writeDebug("1");
 
@@ -452,7 +457,7 @@
       # last resort: lookup the method in the Applications web
       #writeDebug("last resort check for Applications.$thisTopic");
       my $appDB = getDB('Applications');
-      if ($appDB->fastget($thisTopic)) {
+      if ($appDB && $appDB->fastget($thisTopic)) {
         $params->{OBJECT} = $theObject;
         $thisWeb = 'Applications';
       }
@@ -474,6 +479,8 @@
 
   # get web and topic
   my $thisDB = getDB($thisWeb);
+  return inlineError("ERROR: DBALL can't find web $thisWeb") unless $thisDB;
+
   my $topicObj = $thisDB->fastget($thisTopic);
   unless ($topicObj) {
     if ($warn) {

Note that this is no SetVariablePlugin error. Moreover it is a DBCachePlugin problem not being robust enuf to eat unknown webs under certain conditions triggered by SetVariablePlugin.

-- MichaelDaum - 24 Oct 2011

This Patch solved the Problems.

Thank you for the quick Help.

-- OliverSchaub - 24 Oct 2011
 

ItemTemplate edit

Summary Internal Server Error on DBCALL
ReportedBy OliverSchaub
Codebase 1.1.3
SVN Range
AppliesTo Extension
Component DBCachePlugin
Priority Normal
CurrentState Closed
WaitingFor MichaelDaum
Checkins
TargetRelease n/a
ReleasedIn n/a
trunkCheckins
Release01x01Checkins
I Attachment Action Size Date Who Comment
perl-traceback.txttxt perl-traceback.txt manage 8 K 24 Oct 2011 - 06:51 OliverSchaub  
Topic revision: r10 - 24 Nov 2011, OliverSchaub
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy