Bug 1006972

Summary: Enable setting of "JAVA_OPTS_EXT"
Product: OpenShift Container Platform Reporter: Nikhil Mone <nmone>
Component: ContainersAssignee: Jason DeTiberus <jdetiber>
Status: CLOSED ERRATA QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.2.0CC: anande, baulakh, bhatiam, bleanhar, gpei, jdetiber, jialiu, libra-onpremise-devel, nmone, nwei, yanpzhan
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-jbosseap-2.3.11.3-1.git.0.4d0ae9b.el6op, openshift-origin-cartridge-jbossews-0.4.11-1.git.0.727562d.el6op Doc Type: Enhancement
Doc Text:
OpenShift Enterprise users can now customize Java options in JBoss and EWS cartridges with the new JAVA_OPTS_EXT environment variable without modifying or removing the required JAVA_OPTS settings. This feature allows greater compatibility between OpenShift Enterprise and OpenShift Online.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-16 15:39:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
patch for suporting JAVA_OPTS_EXT none

Description Nikhil Mone 2013-09-11 15:36:29 UTC
Description of problem:

Not able to set extra java options in JBoss EAP and EWS cartridges, such as extra tuning and garbage collection parameters.

It would be great if we could have something like :

"rhc env set JAVA_OPTS_EXT"

which is present in latest OpenShift online version.

Version-Release number of selected component (if applicable):

OSE 1.2

How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Jason DeTiberus 2013-09-11 20:58:18 UTC
https://github.com/openshift/enterprise-server/pull/140

Comment 4 Nan Wei 2013-09-29 07:36:23 UTC
Verify this bug on puddle:
http://buildvm-devops.usersys.redhat.com/puddle/build/OpenShiftEnterprise/1.2/2013-09-27.1/

1. Create jbossews 2.0 app
#rhc app create $appname jbossews-2.0

2. Add an user env_vars to the app with name JAVA_OPTS_EXT

[root@node ~]#oo-env-var-add --with-app-uuid 5247c97f5946d3132c00007b --with-container-uuid 5247c97f5946d3132c00007b --with-key JAVA_OPTS_EXT --with-value "-XX:+PrintGCDetails  -Xloggc:gc.log"

3. Restart the app or cartridge to restart the java process

4. Find the gc.log under gear home dir
/var/lib/openshift/5247c97f5946d3132c00007b/jbossews/gc.log

Comment 5 Johnny Liu 2013-09-29 09:25:20 UTC
Currently OSE does not support "rhc env set JAVA_OPTS_EXT", so QE only add user env var using oo-env-var-add on node to verify this bug just like comment 4.

Comment 6 Nan Wei 2013-09-29 09:35:43 UTC
The jbosseap-6.0 app's situation is the same as comment 4.

Comment 7 Jason DeTiberus 2013-09-29 23:41:51 UTC
Nan and Johnny,

The user can still add the variable using a pre_start hook, we should probably test for that situation for OSE 1.2

Comment 8 Nikhil Mone 2013-10-07 17:16:27 UTC
Can the customer get the patch for testing in their env as a part of the QA process prior to the 1.2.4 release?  Any idea when 1.2.4 is going to release ?

Comment 9 Brenton Leanhardt 2013-10-07 17:25:48 UTC
Created attachment 808969 [details]
patch for suporting JAVA_OPTS_EXT

If you look inside the patch you will see standalone.sh is updated for the EAP cartridge and bin/tomcat for EWS.  The files can be found at:

/var/lib/openshift/.cartridge_repository/redhat-jbosseap/0.0.1/versions/6.0/bin/standalone.sh
/var/lib/openshift/.cartridge_repository/redhat-jbossews/0.0.1/bin/tomcat

Comment 11 Johnny Liu 2013-10-08 07:53:23 UTC
(In reply to Jason DeTiberus from comment #7)
> Nan and Johnny,
> 
> The user can still add the variable using a pre_start hook, we should
> probably test for that situation for OSE 1.2

I tried to add the variable using a pre_start hook, here I am not sure what means "add", export is ok??

I did the following operation:

$ cat .openshift/action_hooks/pre_start 
#!/bin/sh
echo "############"
export JAVA_OPTS_EXT="-XX:+PrintGCDetails  -Xloggc:gc.log"
echo $JAVA_OPTS_EXT
echo "############"

$ git push
<--snip-->
remote: Deploying JBoss
remote: ############
remote: -XX:+PrintGCDetails -Xloggc:gc.log
remote: ############
remote: Starting jbosseap cart
remote: Found 127.7.204.129:8080 listening port
<--snip-->

Then ssh into gear to check java process, I did not find "JAVA_OPTS_EXT" parameters for java process. That means pre_start could not add the variable for java process. 

Could you help have a double confirm?

Comment 12 Johnny Liu 2013-10-08 10:19:59 UTC
And one more issue is looks like this does not support scalable app.

When I use oo-env-var-add command to add JAVA_OPTS_EXT var to primary gear, then scale-up, the new gear does not enable JAVA_OPTS_EXT var. Is it expected?

Comment 13 Jason DeTiberus 2013-10-08 13:54:38 UTC
The pre_start hook needs to have the cartridge name included, so pre_start_jbosseap for EAP and pre_start_jbossews for EWS.

.openshift/action_hooks/pre_start_jbosseap:
#!/bin/bash

export JAVA_OPTS_EXT="-XX:+UseG1GC"
echo "JAVA_OPTS_EXT: ${JAVA_OPTS_EXT}"

Output from push:
...
remote: Deploying JBoss
remote: JAVA_OPTS_EXT: -XX:+UseG1GC
remote: Starting jbosseap cart
remote: Found 127.1.244.1:8080 listening port
To ssh://52540a46c1a36e45d3000006.com/~/git/eap.git/
   b12189b..481e5f0  master -> master



VM Arguments before: 
09:36:23,980 DEBUG [org.jboss.as.config] VM Arguments: -D[Standalone] -XX:+UseCompressedOops -XX:+TieredCompilation -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=52540a46c1a36e45d3000006 -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=eap-test.example.com -Djgroups.bind_addr=127.1.244.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on -Dorg.jboss.boot.log.file=/var/lib/openshift/52540a46c1a36e45d3000006/jbosseap/standalone/log/boot.log -Dlogging.configuration=file:/var/lib/openshift/52540a46c1a36e45d3000006/jbosseap/standalone/configuration/logging.properties 


VM Arguments after:
[eap-test.example.com logs]\> ps -ef | grep java
1000     21916 21739  4 09:42 ?        00:00:15 /etc/alternatives/java_sdk_1.7.0/bin/java -D[Standalone] -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=52540a46c1a36e45d3000006 -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=eap-test.example.com -Djgroups.bind_addr=127.1.244.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on -XX:+UseG1GC -Dorg.jboss.boot.log.file=/var/lib/openshift/52540a46c1a36e45d3000006/jbosseap/standalone/log/boot.log -Dlogging.configuration=file:/var/lib/openshift/52540a46c1a36e45d3000006/jbosseap/standalone/configuration/logging.properties -jar /var/lib/openshift/52540a46c1a36e45d3000006/jbosseap/jboss-modules.jar -mp /var/lib/openshift/52540a46c1a36e45d3000006/app-root/runtime/repo//.openshift/config/modules:/var/lib/openshift/52540a46c1a36e45d3000006/jbosseap/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/var/lib/openshift/52540a46c1a36e45d3000006/jbosseap

Comment 14 Johnny Liu 2013-10-09 09:38:11 UTC
Verify this bug with openshift-origin-cartridge-jbosseap-2.3.11.3-1.git.0.4d0ae9b.el6op.noarch, and PASS.


Create pre_start_jbosseap for EAP and pre_start_jbossews for EWS.

$ cat .openshift/action_hooks/pre_start_jbossews 
#!/bin/sh
echo "####bbb########"
export JAVA_OPTS_EXT="-XX:+PrintGCDetails  -Xloggc:gc.log"
echo $JAVA_OPTS_EXT
touch "bbb"
echo "############"
"

Output from push:
...
remote: ####bbb########
remote: -XX:+PrintGCDetails -Xloggc:gc.log
remote: ############
remote: Found 127.1.245.1:8080 listening port
...

ssh into gear, check java process, and found "-XX:+PrintGCDetails  -Xloggc:gc.log" is added to the process.


Test jbosseap and jbossews app including scalable type, both of them are working fine.

[scajbosseapapp-jialiu.ose124-1008.com.cn 525515fb636d0c1004000100]\> ps -ef|grep GC
1004     17482 17256 24 02:36 ?        00:00:23 /etc/alternatives/java_sdk_1.7.0/bin/java -D[Standalone] -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xmx256m -XX:MaxPermSize=102m -XX:+AggressiveOpts -Dorg.apache.tomcat.util.LOW_MEMORY=true -DOPENSHIFT_APP_UUID=525515fb636d0c1004000100 -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djboss.node.name=scajbosseapapp-jialiu.ose124-1008.com.cn -Djgroups.bind_addr=127.1.246.1 -Dorg.apache.coyote.http11.Http11Protocol.COMPRESSION=on -XX:+PrintGCDetails -Xloggc:gc.log -Dorg.jboss.boot.log.file=/var/lib/openshift/525515fb636d0c1004000100/jbosseap/standalone/log/boot.log -Dlogging.configuration=file:/var/lib/openshift/525515fb636d0c1004000100/jbosseap/standalone/configuration/logging.properties -jar /var/lib/openshift/525515fb636d0c1004000100/jbosseap/jboss-modules.jar -mp /var/lib/openshift/525515fb636d0c1004000100/app-root/runtime/repo//.openshift/config/modules:/var/lib/openshift/525515fb636d0c1004000100/jbosseap/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.standalone -Djboss.home.dir=/var/lib/openshift/525515fb636d0c1004000100/jbosseap

Comment 18 errata-xmlrpc 2013-10-16 15:39:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1435.html