Skip to content

Fix overflow in Balanced expand - #13712

Merged
dmitripivkine merged 1 commit into
eclipse-openj9:masterfrom
amicic:overflow_expand
Oct 15, 2021
Merged

dmitripivkine merged 1 commit into
eclipse-openj9:masterfrom
amicic:overflow_expand

Conversation

@amicic

@amicic amicic commented Oct 15, 2021 •

Copy link
Copy Markdown
Contributor

Total heap resizing (based on GC overhead heuristics) may suggest to
expand to a smaller value than current total heap size, leading to
contraction (what might not be problem by itself). The bigger problem is
that internally it's represented as a big (overflowed) unsigned integer
and while arithmetic (+/- operators) will silently work (we will
successfully contract), that's not the case for comparisons (<,>
operators).

If there was a large object alloc request and there is not free enough
memory we may want to expand, but since this alloc size is likely to be
less than the fake expand, it won't be able to trigger the real expand.

Eventually, this may lead to failing to allocate and OOM condition.

The fix is simply to prevent the overflow math and set the expansion
value to 0, if calculated value is negative.

Fixes: #13584

Signed-off-by: Aleksandar Micic amicic@ca.ibm.com

Total heap resizing (based on GC overhead heuristics) may suggest to
expand to a smaller value than current total heap size, leading to
contraction (what might not be problem by itself). The bigger problem is
that internally it's represented as a big (overflowed) unsigned integer
and while arithmetic (+/- operators) will silently work (we will
successfully contract), that's not the case for comparisons (<,>
operators).

If there was a large object alloc request and there is not free enough
memory we may want to expand, but since this alloc size is likely to be
less than the fake expand, it won't be able to trigger the real expand.

Eventually, this may lead to failing to allocate and OOM condition.

The fix is simply to prevent the overflow math and set the expansion
value to 0, if calculated value is negative.

Fixes: eclipse-openj9#13584

Signed-off-by: Aleksandar Micic <amicic@ca.ibm.com>
@dmitripivkine

Copy link
Copy Markdown
Contributor

Jenkins test sanity xLinux jdk11

@pshipton

Copy link
Copy Markdown
Member

This PR testing isn't going to work until artifactory is fixed.

@dmitripivkine

Copy link
Copy Markdown
Contributor

Jenkins test sanity xLinux jdk11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Xgcpolicy:balanced AllocationTest OOM

3 participants