Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8204422 | 11.0.1 | Thomas Schatzl | P3 | Resolved | Fixed | team |
MetaspaceGC::inc_capacity_until_GC presently has
2420 size_t capacity_until_GC = _capacity_until_GC;
2421 size_t new_value = capacity_until_GC + v;
...
2428 size_t expected = _capacity_until_GC;
2429 size_t actual = Atomic::cmpxchg(new_value, &_capacity_until_GC, expected);
If a different thread were to modify _capacity_until_GC between line 2420 and 2428, that modification could be quietly lost.
The refetch of _capacity_until_GC at line 2428 is the culprit. It should be removed, and all uses of "expected" should be replaced with "capacity_until_GC" (which should perhaps be renamed "old_value").
2420 size_t capacity_until_GC = _capacity_until_GC;
2421 size_t new_value = capacity_until_GC + v;
...
2428 size_t expected = _capacity_until_GC;
2429 size_t actual = Atomic::cmpxchg(new_value, &_capacity_until_GC, expected);
If a different thread were to modify _capacity_until_GC between line 2420 and 2428, that modification could be quietly lost.
The refetch of _capacity_until_GC at line 2428 is the culprit. It should be removed, and all uses of "expected" should be replaced with "capacity_until_GC" (which should perhaps be renamed "old_value").
- backported by
-
JDK-8204422 Incorrect cmpxchg usage in MetaspaceGC::inc_capacity_until_GC
-
- Resolved
-
- relates to
-
JDK-8189271 Metaspace::_capacity_until_GC should be size_t
-
- Resolved
-