You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2006/10/12 16:28:03 UTC

Flash messages in session clean up doesn't work, wreck havoc in session

The flash messages in the session throws an exception when the session
tries to clean up these messages.

The list used to store the messages is an CopyOnWriteList whose
iterator doesn't support remove() (is noted in the documentation).

This causes an exception in the detach phase of the RequestCycle, at a
point without a try {} catch block:


		// remove any rendered feedback messages from the session
		session.cleanupFeedbackMessages();
		

This causes the request cycle not to clean up any resources afterwards, such as:

		// Release thread local resources
		threadDetach();

This ensures that the user session is practically rendered useless, as
the pagemap is still attached to a thread. Even though the thread is
already available for further processing, the pagemap of the user is
considered to be locked by the thread.

Two questions:
- catching all runtime exceptions but not propagating could be
considered harmful, shouldn't we rethrow those exceptions?
- shouldn't the clean up methods be excecuted inside a finally block,
to ensure they are always called?

Martijn

-- 
<a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
the World!</a>

Re: Flash messages in session clean up doesn't work, wreck havoc in session

Posted by Johan Compagner <jc...@gmail.com>.
rethrow in the detach phase doesnt make much sense. Where should they go?
The http output is already committed so that can't be changed. The only
thing to do is log it.

Currently all the steps are catched (in head of 1.x and 2.0) so that every
other step is also still executed.





On 10/12/06, Martijn Dashorst <ma...@gmail.com> wrote:
>
> The flash messages in the session throws an exception when the session
> tries to clean up these messages.
>
> The list used to store the messages is an CopyOnWriteList whose
> iterator doesn't support remove() (is noted in the documentation).
>
> This causes an exception in the detach phase of the RequestCycle, at a
> point without a try {} catch block:
>
>
>                 // remove any rendered feedback messages from the session
>                 session.cleanupFeedbackMessages();
>
>
> This causes the request cycle not to clean up any resources afterwards,
> such as:
>
>                 // Release thread local resources
>                 threadDetach();
>
> This ensures that the user session is practically rendered useless, as
> the pagemap is still attached to a thread. Even though the thread is
> already available for further processing, the pagemap of the user is
> considered to be locked by the thread.
>
> Two questions:
> - catching all runtime exceptions but not propagating could be
> considered harmful, shouldn't we rethrow those exceptions?
> - shouldn't the clean up methods be excecuted inside a finally block,
> to ensure they are always called?
>
> Martijn
>
> --
> <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> for <a href="http://www.thebeststuffintheworld.com/stuff/wicket
> ">Wicket</a>
> at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> the World!</a>
>