velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Lynch" <peterly...@mindspring.com>
Subject Re: Velocity exits foreach loop in macro unpredictably, both 1.1 and 1.2-dev
Date Mon, 05 Nov 2001 17:06:29 GMT
Nick,

This bug may be related to your problem.

<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=4483>.

Bottom line: Make sure that template caching is on in production if it is
not. You may have to play with macros inline local scope setting too.

-Peter

----- Original Message -----
From: "Nick Bauman" <nick@cortexity.com>
To: <velocity-user@jakarta.apache.org>
Sent: Monday, November 05, 2001 7:25 AM
Subject: Velocity exits foreach loop in macro unpredictably, both 1.1 and
1.2-dev


> Forgive me my inability to come up with a consise example of how to
> reproduce the error, if I had one I probably could have fixed it myself. I
> can't force this to reproduce itself except under our load testing
> environment at my company. I'm now working to consisely reproduce the
> problem in another contrived situation. I'm asking the community if
anything
>  I'm showing "rings a bell" to a problem.
>
> We use Velocity as a mail templating system. We recently discovered that
in
> thousands of requests over a period of 5 minutes, the resulting merge()
> calls yield mysteriously incomplete emails. No exceptions are thrown,
> everything appears fine in the logs.
>
> Our typical template looks like this:
>
> -----8<-----
>
> #* $Id: Texten_msftrxbx.vtl,v 1.1 2001/11/05 15:06:40 hvanlaar Exp $ *#
> #parse ( "functions.vtl" )
>
> $queue.getEmailSubject()
>
> Thank you for using Acme Center. Below is a copy of your chat session
> transcript for reference.
>
> Topic: $!meeting.getTopic()
>
> #drawStandardTextTranscript( $meeting )
>
> ==========
> $!repId:$meeting.getMeetingId()
>
> -----8<-----
>
> the parsed template, entitled "functions.vtl" looks like this:
>
> -----8<-----
>
> ...[other stuff]...
>
> #macro( drawStandardTextTranscript $meeting )
> #foreach( $event in $meeting.getAllEvents() )
> #set( $yapper = $meeting.getParticipation($event.getFromId()) )
> #if( $event.getClass().getName().equals($urlEvent) )
> $yapper.getName(): $event.getStoredData()
> #elseif( $event.getClass().getName().equals($chatEvent) )
> #if($repRole.equals($yapper.getRole()) )
> #set( $repId = $yapper.getParticipantId() )
> #end
> $yapper.getName(): $event.getStoredData()
> #end
> #end
> #end
>
> ...[other stuff]...
>
> -----8<-----
>
> The problem is the resulting output ocassionally (5-25% of the time) will
> not contain all $event.getStoredData() that it should. However, all the
> other stuff in the template will look fine: the footer and everything
else.
> So, for some of the mails, there should be 15 lines of text, but we only
see
> one or two. It's very strange and I cannot reproduce it outside of our
load
> environment.
>
> Question is: is it possible some wierd threading behavior is ocurring? I'm
> not reusing a new VelocityContext for each call to merge() I'm making a
new
> one each time. All other settings in Velocity are default except the
> template root, which I define.
>
> Thanks for any insights.
>
>
> --
> To unsubscribe, e-mail:
<mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:velocity-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message