[jira] Created: (WSIF-95) Lazy Initialisation has race condition which leads to livelock

"Bernd Eckenfels (JIRA)" <[email protected]> Thu, 22 Jan 2009 01:21:59 -0800 (PST)
Newsgroups gmane.comp.apache.webservices.wsif.devel
Message-ID <1128062330.1232616119734.JavaMail.jira@brutus>
Lazy Initialisation has race condition which leads to livelock
--------------------------------------------------------------

                 Key: WSIF-95
                 URL: https://issues.apache.org/jira/browse/WSIF-95
             Project: Axis-WSIF
          Issue Type: Bug
          Components: Basic Architecture
    Affects Versions: 2.0, 2.1
         Environment: Especially triggered with Java 6
            Reporter: Bernd Eckenfels


The WSIFUtil class does a lazy initialization of the HashMap containing java keywords in the isJavaKeyword() method. Since this is unguarded with a lock on program startup a high concurrency can lead to multiple threads entering the code for filling the hashtable. This leads unfortunatelly to a 100% cpu consumption since put/get are executed concurrently in this case.

The easiest fix would be to move the filling of the map into a static initializer. The big advntage of this is, you can remove the if (keywordMap == null) chec completely and it is thread safe with no locking.


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