You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Dan Bachelder <ch...@chowda.net> on 2001/11/05 17:55:17 UTC

Re: Velocity exits foreach loop in macro unpredictably, both 1.1 and 1.2-dev

Just to add my $.02: I have noticed the same problem in the turbine environment when generating an email using velocity... the main difference was that I do not have a large load... one thread... this may be a different problem in the end, but i was also getting incomplete emails seemingly at random amongst the complete emails.... I will be back on this email thing within the week... so hopefully I can elaborate more then... this is using 1.2-dev...

On Mon, 05 November 2001, "Nick Bauman" wrote:

> 
> 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:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

</dan>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>