JDK-4862640 : (bf) test java/nio/Buffer/LimitDirectMemory.sh fails (64-bit)
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.2
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: itanium
  • Submitted: 2003-05-12
  • Updated: 2016-01-25
  • Resolved: 2006-05-26
Related Reports
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
Name: vsR10238			Date: 05/12/2003


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.4.2-b08 - JDK1.4.2-b22
Testbase       : Regression-test
Platform[s]    : RedHat Linux 2.1 Adv. Server (64bit)
switch/Mode    : -server
Falling test[s]: 
        java/nio/Buffer/LimitDirectMemory.sh 

Regression-test java/nio/Buffer/LimitDirectMemory.sh test fails on JDK1.4.2 (64 bit).

The following table summarizes the test behaviour with both 32 and 64 JDK1.4.2 java versions
on RedHat Linux 2.1 Adv. Server (64 bit, itanium):

---------------------------------------------------------------------
build        64 bit (ia64)                |  32 bit (i586)
---------------------------------------------------------------------
b05          failed  (-XX:MaxDirectMemorySize is not implemented)
......................................................................
b06,b07      failed (sun.nio.MaxDirectMemorySize defined)
......................................................................
b08-b22      failed (as described below)  |  passed
---------------------------------------------------------------------


The first failed testcase is:
runTest -XX:MaxDirectMemorySize=42g -cp ${TESTCLASSES} \                                                       
  LimitDirectMemory true 0 ${MAXDEFAULTPLUSONE}                                                                

The following comments can be found in LimitDirectMemory.sh:
# A really bad value will be ignored.  We will only be able to allocate the default                            
# amount.                                                                                                      

According to these comments the 42g value should be considered senseless and ignored.
But such values are not senseless on 64 bit platforms.

Test source location:
=====================
/java/re/jdk/1.4.2/promoted/latest/ws/j2se/test/java/nio/Buffer/LimitDirectMemory.sh

How to reproduce:
=================
Run the following script (you may need to change its variables)
 
--- script start ---
#!/bin/sh                                                                                                      
                                                                                                               
RESULT_DIR=`pwd`                                                                                               
WORK_DIR=$RESULT_DIR/workDir/test                                                                              
REPORT_DIR=$RESULT_DIR/reportDir                                                                               
JT_HOME="/net/jtgb4u4c/export/sail16/jct-tools/3.1.1"                                                          
JAVA_HOME="/java/re/jdk/1.4.2/promoted/rc/b22/binaries/linux-ia64"                                             
TEST_BASE_PATH="/java/re/jdk/1.4.2/promoted/rc/b22/ws/j2se/test"                                               
                                                                                                               
JEMMY_JAR=/net/jtgb4u4c/export/sail16/Jemmy/jemmy.jar                                                          
                                                                                                               
HOST=`uname -n`                                                                                                
                                                                                                               
TESTWITH=$JAVA_HOME                                                                                            
TESTJAVA=$JAVA_HOME                                                                                            
                                                                                                               
JTOPTS="-server"                                                                                               
TESTVMOPTS="-server"                                                                                           
                                                                                                               
CLASSPATH="$JT_HOME/classes:$JT_HOME/lib/javatest.jar:$JT_HOME/lib/jtreg.jar"                                  
                                                                                                               
export JAVA_HOME                                                                                               
export JT_HOME                                                                                                 
export TESTWITH                                                                                                
export CLASSPATH                                                                                               
                                                                                                               
mkdir -p $WORK_DIR/scratch 2>&1                                                                                
mkdir -p $WORK_DIR/jtData 2>&1                                                                                 
mkdir -p $REPORT_DIR 2>&1                                                                                      
                                                                                                               
#rm $WORK_DIR/jtData/ResultCache.jtw 2>&1                                                                      
                                                                                                               
cd $WORK_DIR/scratch                                                                                           
                                                                                                               
$JAVA_HOME/bin/java -cp $CLASSPATH $JTOPTS \                                                                   
-DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,\                                                     
DISPLAY=:0,HOME=$HOME/.regtest,PATH=/bin:/usr/bin,CPAPPEND=$JEMMY_JAR,\                                        
TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= \                                                           
-DDISPLAY=:0 -DlocalHost="$HOST" -Dprogram=jtreg com.sun.javatest.regtest.Main \                               
-a -v default -batch -params -w "$WORK_DIR" -r "$REPORT_DIR" -t \                                              
"$TEST_BASE_PATH" \                                                                                            
"$TEST_BASE_PATH/java/nio/Buffer/LimitDirectMemory.sh"                                                         
                                                                                                               
--- script end ---

Test output (jtr part):
=======================
....
Testing: -Dsun.nio.MaxDirectMemorySize=1K -cp /tmp/vs144077/test/classes/java/nio/Buffer LimitDirectMemory false 63M 32M
OK - Error not thrown
--- passed as expected
Testing: -XX:MaxDirectMemorySize=42g -cp /tmp/vs144077/test/classes/java/nio/Buffer LimitDirectMemory false 0 64M
OK - Error not thrown
--- passed as expected
Testing: -XX:MaxDirectMemorySize=42g -cp /tmp/vs144077/test/classes/java/nio/Buffer LimitDirectMemory true 0 67108865
--- failed
----------System.err:(2/147)----------
Exception in thread "main" java.lang.RuntimeException: OutOfMemoryError not thrown: 67108865
	at LimitDirectMemory.main(LimitDirectMemory.java:32)
result: Failed. Execution failed: exit code 1


test result: Failed. Execution failed: exit code 1


Specific machine info:
======================
Hostname: JCC-ITANIUM-01
OS: RedHat Linux 2.1 Adv. Server

======================================================================

Comments
EVALUATION The test does not appear to have considered the possibility of running on a 64-bit system. Curiously, the test appears to pass on solaris 64-bit. It is possible that in that case, the VM is unable to properly interpret 42g. If this is an actual VM problem, this bug does not merit showstopper status for mantis. This problem will be fixed in Tiger at the earliest convenience. -- iag@sfbay 2003-05-14 There are a couple of problems here. - The test in question doesn't scale to 64-bit machines. It assumes that an attempt to specify a value of 42g to the -XX:MaxDirectMemorySize flag will be ignored. This is true on 32-bit machines, since 42g parses to a negative number, which is then ignored by sun.misc.VM.maxDirectMemory(), but it's not true on 64-bit machines. - The VM.maxDirectMemory method doesn't behave properly on negative numbers. Rather than taking the hardwired default of 64MB it should instead take the value of Runtime.getRuntime().maxMemory(). This difference is more noticeable now that we have ergonomic GC sizing. I've submitted a separate bug for the second problem (5047688). -- ###@###.### 2004/5/14
05-12-0180