Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CID 157637: Data race undermines locking (LOCK_EVASION) #274

Open
jewzaam opened this issue Dec 13, 2016 · 0 comments
Open

CID 157637: Data race undermines locking (LOCK_EVASION) #274

jewzaam opened this issue Dec 13, 2016 · 0 comments

Comments

@jewzaam
Copy link
Member

jewzaam commented Dec 13, 2016

** CID 157637:  Data race undermines locking  (LOCK_EVASION)
/lightblue-rest/auth/src/main/java/com/redhat/lightblue/rest/auth/jboss/CertLdapLoginModule.java: 138 in com.redhat.lightblue.rest.auth.jboss.CertLdapLoginModule.initialize()()


________________________________________________________________________________________________________
*** CID 157637:  Data race undermines locking  (LOCK_EVASION)
/lightblue-rest/auth/src/main/java/com/redhat/lightblue/rest/auth/jboss/CertLdapLoginModule.java: 138 in com.redhat.lightblue.rest.auth.jboss.CertLdapLoginModule.initialize()()
132
133             int rolesCacheExpiry = 5*60*1000; // default 5 minutes
134             if (options.containsKey(ROLES_CACHE_EXPIRY_MS)) {
135                 rolesCacheExpiry = Integer.parseInt((String)options.get(ROLES_CACHE_EXPIRY_MS));
136             }
137
>>>     CID 157637:  Data race undermines locking  (LOCK_EVASION)
>>>     Thread2 checks "lbLdap", reading it after Thread1 assigns to "lbLdap" but before some of the correlated field assignments can occur. It sees the condition "com.redhat.lightblue.rest.auth.jboss.CertLdapLoginModule.lbLdap == null" as being false. It continues on before the critical section has completed, and can read data changed by that critical section while it is in an inconsistent state.
138             if (lbLdap == null) {
139                 synchronized(LdapRolesProvider.class) {
140                     if (lbLdap == null) {
141                         lbLdap = new CachedRolesProvider(new LdapRolesProvider(searchBase, ldapConf), new RolesCache(rolesCacheExpiry));
142                     }
143                 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant