...
Failing to ensure the visibility of a shared primitive variable may result in a thread observing a stale value of the variable.
Rule | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
VNA00-J | Medium | Probable | Medium | P8 | L2 |
Automated Detection
Some static analysis tools are capable of detecting violations of this rule.
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
CodeSonar |
| JAVA.CONCURRENCY.LOCK.ICS | Impossible Client Side Locking (Java) | ||||||
Eclipse | 4.2.0 |
Not Implemented | |
FindBugs | 2.0.1 |
Not Implemented | ||
Parasoft Jtest |
|
|
|
CERT.VNA00.LORD |
CERT.VNA00.MRAV |
Ensure that nested locks are ordered correctly Access related Atomic variables in a synchronized block | |
PMD | 5.0.0 |
Not Implemented | |
Fortify |
Not Implemented | |||||||||
Coverity | 7.5 | SERVLET_ATOMICITY | Implemented | ||||||
ThreadSafe |
| CCE_SL_INCONSISTENT | Implemented |
Related Guidelines
CWE-413, Improper Resource Locking |
Bibliography
Item 66, "Synchronize Access to Shared Mutable Data" | |
Section 3.4.2, "Example: Using Volatile to Publish Immutable Objects" | |
[JLS 2015] | Chapter 17, "Threads and Locks" |
[JPL 2006] | Section 14.10.3, "The Happens-Before Relationship" |
...
...