You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Jarkko Viinamäki (JIRA)" <de...@velocity.apache.org> on 2010/01/04 13:05:54 UTC

[jira] Commented: (VELOCITY-750) org.apache.velocity.runtime.RuntimeInstance initialization is not ThreadSafe

    [ https://issues.apache.org/jira/browse/VELOCITY-750?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12796154#action_12796154 ] 

Jarkko Viinamäki commented on VELOCITY-750:
-------------------------------------------

I took a look at sources of 1.6.2 and 1.6.3 releases. They both have this (broken) code:

    /**
     * Indicate whether the Runtime is in the midst of initialization.
     */
    private boolean initializing = false;

    /**
     * Indicate whether the Runtime has been fully initialized.
     */
    private boolean initialized = false;

which shows that the initialized variable is not marked as volatile. However, current SVN head has the volatile modification (since revision 737363 by Byron). I think with the volatile modifier it should work under Java 1.5+. However, I guess we still officially support also Java 1.3+ so it doesn't work there since the Java Memory Management Model is different. Then again, who still uses such old JREs (1.5 was released 2004)?

> org.apache.velocity.runtime.RuntimeInstance initialization is not ThreadSafe
> ----------------------------------------------------------------------------
>
>                 Key: VELOCITY-750
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-750
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.2, 1.6.x
>         Environment: Vista, Java 1.6
>            Reporter: Cenek Rauscher
>             Fix For: 1.6.x
>
>
> Two threads call Velocity.evaluate() method.
> Call RuntimeInstance.parse() and requireInitialization() method.
> One thread trying make initialization, set "initializing" to true and the other thread does not wait until initialization is done and go on.
> At next line Parser parser = (Parser) parserPool.get() is NullPointerException thrown.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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