United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-5042840 Regression test java/nio/Buffer/LimitDirectMemory.sh fails on 64-bit machines
JDK-5042840 : Regression test java/nio/Buffer/LimitDirectMemory.sh fails on 64-bit machines

Details
Type:
Bug
Submit Date:
2004-05-05
Status:
Resolved
Updated Date:
2005-05-28
Project Name:
JDK
Resolved Date:
2005-05-28
Component:
other-libs
OS:
linux_suse_sles_8
Sub-Component:
other
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
5.0
Fixed Versions:
1.4.2_09 (b02)

Related Reports
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description

Name: kaR10181			Date: 05/05/2004


Filed By       : J2SE-SQA [###@###.###
JDK            : JDK1.5.0-b49
Testbase       : Regression1.5_new-cte
Platform[s]    : SuSE SLES 8
switch/Mode    : -server
Falling test[s]:
        CTE_REGTEST/Generic/4879883/LimitDirectMemory.sh

Regression1.5_new-cte CTE_REGTEST/Generic/4879883/LimitDirectMemory.sh 
test fails with JDK1.5.0-b49
The bug is reprodusible on AMD64 only.

Test source location:
=====================
/net/jdk/export/jpse04/Regression/1.5.0/test/cte/CTE_REGTEST/Generic/4879883/LimitDirectMemory.sh

jtr file location:
==================
/net/jtgb4u4c/export/sail15/results.2/tiger/b49/regtest/linux/Sles8_test_server_jck-amd1/workDir/cte/CTE_REGTEST/Generic/4879883/LimitDirectMemory.jtr

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

#Paths in Java Software:
JT_HOME="/java/re/jct-tools/3.1.2/archive/fcs/binaries"
JEMMY_JAR="/net/jdk.sfbay/export/jpse04/Jemmy/jemmy.jar"
JAVA_HOME="/java/re/jdk/1.5.0/promoted/all/b49/binaries/linux-amd64"
TEST_BASE_PATH="/net/jdk/export/jpse04/Regression/1.5.0/test"

#Alternative paths outside Java Software
#JT_HOME="/net/koori.sfbay/onestop/jct-tools/3.1.2/archive/fcs/binaries"
#JEMMY_JAR="/net/jdk.sfbay/export/jpse04/Jemmy/jemmy.jar"
#JAVA_HOME="/net/koori.sfbay/onestop/jdk/1.5.0/promoted/all/b49/binaries/linux-amd64"
#TEST_BASE_PATH="/net/jdk/export/jpse04/Regression/1.5.0/test"

#Alternative paths for the NSK site:
#JT_HOME="/net/linux-15/export/home/java/jct"
#JEMMY_JAR="$JT_HOME/jemmy/jemmy.jar"
#JAVA_HOME="/net/linux-15/export/home/java/jdk1.5.0/linux"
#TEST_BASE_PATH="/net/jtgb4u4c/export/sail1/testarea/regression1.5/cte"


TESTVMOPTS="-server"
CLASSPATH="$JT_HOME/classes:$JT_HOME/lib/javatest.jar:$JT_HOME/lib/jtreg.jar"

TEST="CTE_REGTEST/Generic/4879883/LimitDirectMemory.sh"

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 -showversion -server -cp $CLASSPATH -DenvVars=TESTJAVAHOME=$JAVA_HOME,TESTVMOPTS=$TESTVMOPTS,DISPLAY=$DISPLAY,HOME=$HOME/.regtest,PATH=/bin:/usr/bin,CPAPPEND=$JEMMY_JAR,TZ=,LC_ALL=en_US,LC_CTYPE=en_US,LANG=en_US,LPDEST= 
-DDISPLAY=$DISPLAY -DlocalHost=`uname -n` -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/$TEST"

--- script end ---

Script output:
==============

Test output (jtr part):
=======================
----------System.out:(57/4073)----------
Testing: -XX:MaxDirectMemorySize=10 -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory true 10 1
java.lang.OutOfMemoryError: Direct buffer memory
    at java.nio.Bits.reserveMemory(Bits.java:624)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at LimitDirectMemory.main(LimitDirectMemory.java:31)
OK - Error thrown as expected
--- passed as expected
Testing: -XX:MaxDirectMemorySize=1k -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory true 1k 100
java.lang.OutOfMemoryError: Direct buffer memory
    at java.nio.Bits.reserveMemory(Bits.java:624)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at LimitDirectMemory.main(LimitDirectMemory.java:31)
OK - Error thrown as expected
--- passed as expected
Testing: -XX:MaxDirectMemorySize=10m -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory true 10m 10m
java.lang.OutOfMemoryError: Direct buffer memory
    at java.nio.Bits.reserveMemory(Bits.java:624)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at LimitDirectMemory.main(LimitDirectMemory.java:31)
OK - Error thrown as expected
--- passed as expected
Testing: -XX:MaxDirectMemorySize=65M -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory false 64M 65M
OK - Error not thrown
--- passed as expected
Testing: -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory false 10 1
OK - Error not thrown
--- passed as expected
Testing: -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory false 0 DEFAULT
OK - Error not thrown
--- passed as expected
Testing: -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory true 0 DEFAULT+1
java.lang.OutOfMemoryError: Direct buffer memory
    at java.nio.Bits.reserveMemory(Bits.java:624)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at LimitDirectMemory.main(LimitDirectMemory.java:31)
OK - Error thrown as expected
--- passed as expected
Testing: -XX:MaxDirectMemorySize=0 -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory true 0 1
java.lang.OutOfMemoryError: Direct buffer memory
    at java.nio.Bits.reserveMemory(Bits.java:624)
    at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:95)
    at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:288)
    at LimitDirectMemory.main(LimitDirectMemory.java:31)
OK - Error thrown as expected
--- passed as expected
Testing: -Dsun.nio.MaxDirectMemorySize=1K -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory false DEFAULT-1 DEFAULT/2
OK - Error not thrown
--- passed as expected
Testing: -XX:MaxDirectMemorySize=42g -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory false 0 DEFAULT
OK - Error not thrown
--- passed as expected
Testing: -XX:MaxDirectMemorySize=42g -cp 
/net/jtgb4u4c/export/sail16/results_full/tiger/b49/regtest/Sles8_test_server_jck-amd1/workDir/cte/classes/CTE_REGTEST/Generic/4879883 
LimitDirectMemory true 0 DEFAULT+1M
--- failed
----------System.err:(2/147)----------
Exception in thread "main" java.lang.RuntimeException: OutOfMemoryError 
not thrown: 86245376
    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: jck-amd1
OS: SuSE SLES 8



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

                                    

Comments
EVALUATION

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).

The equivalent test in the J2SE regression suite also fails on 64-bit machines.
We will fix that test (4862640), but it'll up to CTE to apply the corresponding
fix to their copy of it.  (It would probably make more sense for that test
simply to be deleted from the CTE suite since it's redundant.)

-- ###@###.### 2004/5/14
                                     
180-12-05 0



Hardware and Software, Engineered to Work Together