History | Log In     View a printable version of the current page.  
Hyperic HQ 3.2.5-EE Maintenance Release is Now Available
Issue Details (XML | Word | Printable)

Key: HHQ-1951
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Ryan Morgan
Reporter: Brad Felmey (PDX)
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hyperic HQ

Configuration Option server.java.opts in hq-server.conf Broken When Read by hq-server.sh.

Created: 08/Apr/08 01:25 PM   Updated: 17/Apr/08 06:04 AM
Component/s: Server
Affects Version/s: 3.2.2
Fix Version/s: 4.0.0, 3.2.3

Environment: HQ v3.2.2 on SLES 10 64-bit

Verify By: Kashyap Parikh
3.0 Category: Scalability & Performance
Last comment: 25 weeks, 4 days ago
Resolution Date: 09/Apr/08 12:36 PM


 Description  « Hide
The method in hq-server.sh for obtaining the value of server.java.opts in hq-server.conf is broken. Specifically, the sourcing of the TMPPROPFILE fails because the value of server.java.opts contains spaces. This failure ensures that no configuration changes to this option are ever picked up by the server.

The original function:

# Load JAVA_OPTS. Changes to this file will be lost on server upgrades. To set this
# value permanently, set server.java.opts in conf/hq-server.conf

loadJavaOpts () {
  TMPPROPFILE="${SERVER_HOME}/logs/.hq-server.conf.tmp"
  cat ${SERVER_HOME}/conf/hq-server.conf | grep server\.java\.opts | grep -v "^#" | sed 's/\./_/g' > ${TMPPROPFILE}
  . ${TMPPROPFILE} 2> /dev/null
  rm -f ${TMPPROPFILE}
  if [ "x${server_java_opts}" = "x" ] ; then
    echo "-XX:MaxPermSize=192m -Xmx512m -Xms512m"
  fi
  echo "${server_java_opts}"
}

Suggested replacement:

loadJavaOpts () {
  server_java_opts=`grep ^[ ]*server\.java\.opts ${SERVER_HOME}/conf/hq-server.conf | sed 's/[ ]*server\.java\.opts=//'`
  if [ -z "${server_java_opts}" ]; then
  echo "-XX:MaxPermSize=192m -Xmx512m -Xms512m"
  fi
  echo "${server_java_opts}"
}

Note that the contents of the [ ] in the grep and sed commands above would be both a single space and a single tab (insert the tab with <ctrl-v>, then hitting tab key). This searches for any line with zero or more whitespace, followed by the server.java.opts line. This eliminates having to then "grep -v" any matches that are commented out (with a #), and matches any lines that a careless admin would have inserted with leading whitespace. Sed correspondingly looks for any leading whitespace so it can be discarded.

I also cleaned up the if test to register true for zero-length ${server_java_opts}.

All suggested code above tested under bash and ksh on Linux and AIX.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Ryan Morgan - 08/Apr/08 01:44 PM
Nice catch Brad. Marking for inclusion in 3.2.3 and 4.0.

Ryan Morgan - 09/Apr/08 12:36 PM

Patch applied for both 3.2.3 and 4.0.0. Fixes in 4.0.0 build #676, 3.2.3 build #653

Kashyap Parikh - 14/Apr/08 04:57 PM
Looks good. Changes to java opts in hq-server.conf has always worked for me before this fix as well (with enclosing value in double quotes)