You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by Lauri Liinat <La...@microlink.ee> on 2004/08/06 01:46:45 UTC

Line #135 in BaseEngine of 3.0 release

I guess this is a *nasty* bug:

Line #135, BaseEngine.java (3.0 release)
------
        if (_recorders != null)
            return result = (IPageRecorder) _recorders.get(pageName);

        // So the page is active, but not in the cache of page recoders,
        // so (re-)create the page recorder.
------

Disaster is guaranteed if the following conditions are met:

  1) The servlet container actually serializes session attributes, as
with clustering

  2) The request cycle accesses multiple pages, as is common with action
forms
      which call requestCycle.activate(...) on another page

Basically what happens is that only the first page that is loaded into
the request cycle
gets a new page recorder after engine deserialization, all the other
pages get a NULL
and all their existing persistent properties are GONE during this
request cycle.

It is easy to see why - have a look at the beginning of
createPageRecorder(...) method:
------
        if (_recorders == null)
            _recorders = new HashMap(MAP_SIZE);
------

and now look once more at line #135 in getPageRecorder(...) method:
------
        if (_recorders != null)
            return result = (IPageRecorder) _recorders.get(pageName);
------

It is obvious that for all pages other than the one loaded first, a NULL
is returned from the Map!

I think the following change is a sufficient remedy:
------
        if (_recorders != null)
        {
            result = (IPageRecorder) _recorders.get(pageName);
            if (result != null) return result;
        }
------

What do others think?

regards,
lauri

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org


Re: Line #135 in BaseEngine of 3.0 release

Posted by Howard Lewis Ship <hl...@gmail.com>.
Something to look into. Seems like with a bug that obvious, someone
would have seen it. I'll find some time to look into it shortly.

On Fri, 6 Aug 2004 02:46:45 +0300, Lauri Liinat
<la...@microlink.ee> wrote:
> 
> I guess this is a *nasty* bug:
> 
> Line #135, BaseEngine.java (3.0 release)
> ------
>         if (_recorders != null)
>             return result = (IPageRecorder) _recorders.get(pageName);
> 
>         // So the page is active, but not in the cache of page recoders,
>         // so (re-)create the page recorder.
> ------
> 
> Disaster is guaranteed if the following conditions are met:
> 
>   1) The servlet container actually serializes session attributes, as
> with clustering
> 
>   2) The request cycle accesses multiple pages, as is common with action
> forms
>       which call requestCycle.activate(...) on another page
> 
> Basically what happens is that only the first page that is loaded into
> the request cycle
> gets a new page recorder after engine deserialization, all the other
> pages get a NULL
> and all their existing persistent properties are GONE during this
> request cycle.
> 
> It is easy to see why - have a look at the beginning of
> createPageRecorder(...) method:
> ------
>         if (_recorders == null)
>             _recorders = new HashMap(MAP_SIZE);
> ------
> 
> and now look once more at line #135 in getPageRecorder(...) method:
> ------
>         if (_recorders != null)
>             return result = (IPageRecorder) _recorders.get(pageName);
> ------
> 
> It is obvious that for all pages other than the one loaded first, a NULL
> is returned from the Map!
> 
> I think the following change is a sufficient remedy:
> ------
>         if (_recorders != null)
>         {
>             result = (IPageRecorder) _recorders.get(pageName);
>             if (result != null) return result;
>         }
> ------
> 
> What do others think?
> 
> regards,
> lauri
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 
> 


-- 
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org