Priority: Urgent
Current State: Closed
Released In: 1.0.1, 1.0.8
Target Release: patch
Applies To: Engine
Component: Func::addToHEAD
Branches:
Foswiki::Contrib::JSCalendarContrib::addHEAD cannot be used in beforeCommonTagsHandler, commonTagsHandler, or afterCommonTagsHandler
The contrib help text says it can but this is not true
The loops happens like this
We are in a plugin in commonTagsHandler for example.
We call Foswiki::Contrib::JSCalendarContrib::addHEAD
Inside this we call again Foswiki::Func::addToHEAD
The Foswiki::Func::addToHEAD contains a call to Foswiki.pm's addToHead
This again calls local function handleCommonTags
And part of this is to call among others commonTagsHandler
commonTagsHandler again calls Foswiki::Contrib::JSCalendarContrib::addHEAD
And then we loop again and again and again until we run out of memory.
We need the Foswiki::Contrib::JSCalendarContrib::addHEAD to not be called more than once per plugin but we need to do it without using a global variable as such a variable will fail in mod_perl.
As work around calling from e.g. postRenderingHandler can do the job.
--
KennethLavrsen - 30 Jan 2009
I think I have a solution
I will ask in the #foswiki if my approach is OK but for now assume that I fix this
--
KennethLavrsen - 30 Jan 2009
Also the Foswiki::Func::addToHEAD loops so you cannot use that in commonTagsHandler either.
SO it is there we need to break the loop. I have an idea
--
KennethLavrsen - 30 Jan 2009
I added a prevention against re-entry of Foswiki::Func::addToHEAD.
This also prevents ...JSCalendarContrib::addHEAD from deep recursing.
I still consider adding this type of protection also to ...JSCalendarContrib::addHEAD because it is an awful waste of CPU that is used to call this function easily 20-30 times in vain.
--
KennethLavrsen - 31 Jan 2009
I reopened this task to document the new field in the session object.
--
GilmarSantosJr - 31 Jan 2009
As far as I see the deep recursion fix must go one level deeper right into
Foswiki::addToHEAD
. That's where the recursion happens. This will protect against all deep recursion triggers, even those done by ADDTOHEAD itself via its
topic
param.
Reopening and marking urgent. Too bad the former fix wasn't done properly.
--
MichaelDaum - 16 Oct 2009
Ported to release branch. Applied Michael's backport patch.
--
KennethLavrsen - 17 Oct 2009