You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Stephane Bailliez <st...@haht.com> on 2002/02/22 20:00:35 UTC

ASTStringLiteral

I think there is a bug in ASTStringLiteral (pure guess, it's getting late
here so I have to go). I'm having NPEs from time to time when putting
velocity in high load stress with 20 concurrent requests.

in ASTStringLiteral::value(InternalContextAdapter) i quickly changed the log
to have the full stacktrace and output the literal.

22 Feb 2002 19:32:44 [HttpProcessor[8080][6]] [ERROR] [velocity] - VM error
: hasRightsOnCurrentFolder. Null AST
22 Feb 2002 19:32:44 [HttpProcessor[8080][6]] [ERROR] [velocity] - Error in
interpolating string literal : #hasRightsOnCurrentFolder()
22 Feb 2002 19:32:44 [HttpProcessor[8080][6]] [ERROR] [velocity] -
java.lang.NullPointerException
	at java.io.Writer.write(Writer.java:107)
	at
org.apache.velocity.runtime.parser.node.ASTText.render(ASTText.java:99)
	at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:27
1)
	at
org.apache.velocity.runtime.parser.node.ASTStringLiteral.value(ASTStringLite
ral.java:183)
	at
org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirecti
ve.java:135)
	at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
	at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement
.java:109)
	at
org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:94)
	at
org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement
.java:109)
	at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:27
1)
	at
org.apache.velocity.runtime.directive.Parse.render(Parse.java:232)
	at
org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.jav
a:153)
	at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:27
1)
	at org.apache.velocity.Template.merge(Template.java:296)
	at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:492)
	at org.apache.velocity.app.Velocity.mergeTemplate(Velocity.java:461)
[...]

It looks like child nodes are not initialized so I'm wondering if it is no
due to the if nodeTree == null that need to synchronized (yek !) or at least
it should be inited before being assigned, ie changed to:

SimpleNode tree  = rsvc.parse( br,context.getCurrentTemplateName() );

tree.init( context, rsvc );
nodeTree = tree;

I will do more testing by monday (throwing ThreadAlyzer) but this is my
first guess as of now so take this with the appropriate load of salt. :)

Stephane

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


Re: ASTStringLiteral

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/22/02 2:00 PM, "Stephane Bailliez" <st...@haht.com> wrote:

> 
> I think there is a bug in ASTStringLiteral (pure guess, it's getting late
> here so I have to go). I'm having NPEs from time to time when putting
> velocity in high load stress with 20 concurrent requests.
> 
> in ASTStringLiteral::value(InternalContextAdapter) i quickly changed the log
> to have the full stacktrace and output the literal.
> 
> 
> It looks like child nodes are not initialized so I'm wondering if it is no
> due to the if nodeTree == null that need to synchronized (yek !) or at least
> it should be inited before being assigned, ie changed to:
> 
> SimpleNode tree  = rsvc.parse( br,context.getCurrentTemplateName() );
> 
> tree.init( context, rsvc );
> nodeTree = tree;
> 
> I will do more testing by monday (throwing ThreadAlyzer) but this is my
> first guess as of now so take this with the appropriate load of salt. :)

I think your analysis is right.  That code is susceptible to problems at
high stress.  (I wrote that...)

I'll fix - can you test now?


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
The question is : What is a Mahnamahna?


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