You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Stu Belden (JIRA)" <ji...@apache.org> on 2006/06/22 14:06:30 UTC

[jira] Updated: (VELOCITY-383) NPE when processing template under heavy concurrent load

     [ http://issues.apache.org/jira/browse/VELOCITY-383?page=all ]

Stu Belden updated VELOCITY-383:
--------------------------------

    Attachment: Example.java

Proof of concept for the lack of thread safety in the Template class.  This will  work with the default velocity properties, and (probably) any velocity template.  This POC is heavily inspired by the example "app_example1" that ships with the distribuition. 

> NPE when processing template under heavy concurrent load
> --------------------------------------------------------
>
>          Key: VELOCITY-383
>          URL: http://issues.apache.org/jira/browse/VELOCITY-383
>      Project: Velocity
>         Type: Bug

>   Components: Source
>     Versions: 1.4
>  Environment: Operating System: Windows XP
> Platform: PC
>     Reporter: Hans
>     Priority: Critical
>  Attachments: Example.java
>
> During load testing the server, with 50 concurrent users, the 
> VelocityViewServlet would throw a null pointer exception about 3% of the time. 
> 97% of the time, the page would serve normally.
> Below is the trace:
> java.lang.NullPointerException
> 	at org.apache.velocity.runtime.parser.node.ASTDirective.init
> (ASTDirective.java:94)
> 	at org.apache.velocity.runtime.parser.node.SimpleNode.init
> (SimpleNode.java:201)
> 	at org.apache.velocity.Template.initDocument(Template.java:199)
> 	at org.apache.velocity.Template.process(Template.java:124)
> 	at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource
> (ResourceManagerImpl.java:423)
> 	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource
> (ResourceManagerImpl.java:341)
> 	at org.apache.velocity.runtime.RuntimeInstance.getTemplate
> (RuntimeInstance.java:831)
> 	at org.apache.velocity.runtime.RuntimeInstance.getTemplate
> (RuntimeInstance.java:813)
> 	at org.apache.velocity.runtime.RuntimeSingleton.getTemplate
> (RuntimeSingleton.java:285)
> 	at 
> org.apache.velocity.tools.view.servlet.VelocityViewServlet.getTemplate
> (VelocityViewServlet.java:540)
> 	at 
> org.apache.velocity.tools.view.servlet.VelocityViewServlet.handleRequest
> (VelocityViewServlet.java:475)
> 	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest
> (VelocityViewServlet.java:407)
> 	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doPost
> (VelocityViewServlet.java:383)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:237)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:157)
> 	at org.apache.catalina.core.ApplicationDispatcher.invoke
> (ApplicationDispatcher.java:674)
> 	at org.apache.catalina.core.ApplicationDispatcher.doInclude
> (ApplicationDispatcher.java:576)
> 	at org.apache.catalina.core.ApplicationDispatcher.include
> (ApplicationDispatcher.java:501)
> 	at org.apache.velocity.tools.view.ImportSupport.acquireString
> (ImportSupport.java:140)
> 	at org.apache.velocity.tools.struts.TilesTool.doInsert
> (TilesTool.java:476)
> 	at org.apache.velocity.tools.struts.TilesTool.doInsert
> (TilesTool.java:419)
> 	at org.apache.velocity.tools.struts.TilesTool.processUrl
> (TilesTool.java:398)
> 	at org.apache.velocity.tools.struts.TilesTool.processAsDefinitionOrURL
> (TilesTool.java:357)
> 	at org.apache.velocity.tools.struts.TilesTool.processObjectValue
> (TilesTool.java:305)
> 	at org.apache.velocity.tools.struts.TilesTool.get(TilesTool.java:135)
> 	at sun.reflect.GeneratedMethodAccessor136.invoke(Unknown Source)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> 	at java.lang.reflect.Method.invoke(Unknown Source)
> 	at org.apache.velocity.runtime.parser.node.GetExecutor.execute
> (GetExecutor.java:65)
> 	at 
> org.apache.velocity.util.introspection.UberspectImpl$VelGetterImpl.invoke
> (UberspectImpl.java:302)
> 	at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute
> (ASTIdentifier.java:157)
> 	at org.apache.velocity.runtime.parser.node.ASTReference.execute
> (ASTReference.java:175)
> 	at org.apache.velocity.runtime.parser.node.ASTReference.render
> (ASTReference.java:220)
> 	at org.apache.velocity.runtime.parser.node.SimpleNode.render
> (SimpleNode.java:230)
> 	at org.apache.velocity.Template.merge(Template.java:256)
> 	at 
> org.apache.velocity.tools.view.servlet.VelocityViewServlet.mergeTemplate
> (VelocityViewServlet.java:592)
> 	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest
> (VelocityViewServlet.java:417)
> 	at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doPost
> (VelocityViewServlet.java:383)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:237)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:157)
> 	at org.apache.catalina.core.ApplicationDispatcher.invoke
> (ApplicationDispatcher.java:674)
> 	at org.apache.catalina.core.ApplicationDispatcher.processRequest
> (ApplicationDispatcher.java:465)
> 	at org.apache.catalina.core.ApplicationDispatcher.doForward
> (ApplicationDispatcher.java:400)
> 	at org.apache.catalina.core.ApplicationDispatcher.forward
> (ApplicationDispatcher.java:303)
> 	at org.apache.struts.action.RequestProcessor.doForward
> (RequestProcessor.java:1063)
> 	at org.apache.struts.tiles.TilesRequestProcessor.doForward
> (TilesRequestProcessor.java:263)
> 	at org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition
> (TilesRequestProcessor.java:239)
> 	at org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig
> (TilesRequestProcessor.java:302)
> 	at org.apache.struts.action.RequestProcessor.process
> (RequestProcessor.java:229)
> 	at org.apache.struts.action.ActionServlet.process
> (ActionServlet.java:1194)
> 	at org.apache.struts.action.ActionServlet.doPost
> (ActionServlet.java:432)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
> (ApplicationFilterChain.java:237)
> 	at org.apache.catalina.core.ApplicationFilterChain.doFilter
> (ApplicationFilterChain.java:157)
> 	at org.apache.catalina.core.StandardWrapperValve.invoke
> (StandardWrapperValve.java:214)
> 	at org.apache.catalina.core.StandardContextValve.invoke
> (StandardContextValve.java:178)
> 	at org.apache.catalina.core.StandardHostValve.invoke
> (StandardHostValve.java:126)
> 	at org.apache.catalina.valves.ErrorReportValve.invoke
> (ErrorReportValve.java:105)
> 	at org.apache.catalina.core.StandardEngineValve.invoke
> (StandardEngineValve.java:107)
> 	at org.apache.catalina.connector.CoyoteAdapter.service
> (CoyoteAdapter.java:148)
> 	at org.apache.coyote.http11.Http11Processor.process
> (Http11Processor.java:825)
> 	at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnecti
> on(Http11Protocol.java:731)
> 	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket
> (PoolTcpEndpoint.java:526)
> 	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt
> (LeaderFollowerWorkerThread.java:80)
> 	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
> (ThreadPool.java:684)
> 	at java.lang.Thread.run(Unknown Source)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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