[jboss-jira] [JBoss JIRA] Commented: (JBREM-1218) ConnectionValidator.isValid should be volatile

Ron Sigal (JIRA) jira-events at lists.jboss.org
Thu Apr 8 11:04:38 EDT 2010


    [ https://jira.jboss.org/jira/browse/JBREM-1218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12524602#action_12524602 ] 

Ron Sigal commented on JBREM-1218:
----------------------------------

That's a good point.  Fortunately, the shared variable isn't accessed inside synchronized blocks.  I say "fortunately" because I have no other way of explaining what I see in the logs.

I guess I didn't think about synchronized blocks because one thread won't look at the variable until the other thread sets the value and tells it to look, so, superficially, it all makes sense.

> ConnectionValidator.isValid should be volatile
> ----------------------------------------------
>
>                 Key: JBREM-1218
>                 URL: https://jira.jboss.org/jira/browse/JBREM-1218
>             Project: JBoss Remoting
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 2.5.2.SP2 (Flounder), 2.2.3.SP2
>            Reporter: Ron Sigal
>            Assignee: Ron Sigal
>             Fix For: 2.5.2.SP3 (Flounder), 2.2.3.SP3
>
>
> org.jboss.remoting.ConnectionValidator's variable isValid is set in run(), which runs in one thread, and is read in ConnectionValidator.WaitOnConnectionCheckTimerTask.run(), which runs in another thread.  After ConnectionValidator.run()  sets isValid, is calls notifyAll() on a lock, which wakes up WaitOnConnectionCheckTimerTask.run(), which then looks at the value of isValid.  It's possible for the most recent value of isValid to not yet be visible to WaitOnConnectionCheckTimerTask.run().

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

        


More information about the jboss-jira mailing list