Skip to content

Commit ed007fc

Browse files
committed
Fix for Issue #262, java-default-options must check if maxMetaSpaceSize is defined
1 parent 0211be6 commit ed007fc

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

modules/jvm/bash/artifacts/opt/jboss/container/java/jvm/java-default-options

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,11 @@ gc_config() {
144144

145145
if [ -n "${GC_METASPACE_SIZE}" ]; then
146146
metaspaceSize=${GC_METASPACE_SIZE}
147-
# clamp the max size of metaspaceSize to be <= maxMetaspaceSize
148-
if [ "${metaspaceSize}" -gt "${maxMetaspaceSize}" ]; then
149-
metaspaceSize=${maxMetaspaceSize}
147+
if [ -n "${maxMetaspaceSize}" ]; then
148+
# clamp the max size of metaspaceSize to be <= maxMetaspaceSize
149+
if [ "${metaspaceSize}" -gt "${maxMetaspaceSize}" ]; then
150+
metaspaceSize=${maxMetaspaceSize}
151+
fi
150152
fi
151153
fi
152154

tests/features/java/gc.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,20 @@ Feature: Openshift OpenJDK GC tests
5353
Then s2i build log should contain Using MAVEN_OPTS -XX:+UseG1GC
5454
And container log should contain -XX:+UseG1GC
5555
And container log should not contain -XX:+UseParallelGC
56+
57+
Scenario: Check GC_METASPACE_SIZE GC configuration
58+
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
59+
| variable | value |
60+
| GC_METASPACE_SIZE | 120 |
61+
Then s2i build log should contain -XX:MetaspaceSize=120m
62+
And container log should contain -XX:MetaspaceSize=120m
63+
And container log should not contain integer expression expected
64+
65+
Scenario: Check GC_METASPACE_SIZE constrained by GC_MAX_METASPACE_SIZE GC configuration
66+
Given s2i build https://github.com/jboss-openshift/openshift-quickstarts from undertow-servlet
67+
| variable | value |
68+
| GC_METASPACE_SIZE | 120 |
69+
| GC_MAX_METASPACE_SIZE | 90 |
70+
Then s2i build log should contain -XX:MaxMetaspaceSize=90m -XX:MetaspaceSize=90m
71+
And container log should contain -XX:MaxMetaspaceSize=90m -XX:MetaspaceSize=90m
72+

0 commit comments

Comments
 (0)