RFR: Fix NullPointerException on a parallel run [v2]
Dmitry Bessonov
dbessono at openjdk.org
Wed Aug 24 14:00:41 UTC 2022
On Thu, 18 Aug 2022 07:55:05 GMT, Jan Kratochvil <duke at openjdk.org> wrote:
>> Error: Unexpected exception occurred! java.lang.NullPointerException
>> java.lang.NullPointerException
>> at com.sun.javatest.regtest.config.TestProperties$Cache.getEntryInternal(TestProperties.java:515)
>> at com.sun.javatest.regtest.config.TestProperties$Cache.getEntryInternal(TestProperties.java:515)
>> at com.sun.javatest.regtest.config.TestProperties$Cache.getEntry(TestProperties.java:502)
>> at com.sun.javatest.regtest.config.TestProperties.getEntry(TestProperties.java:170)
>> at com.sun.javatest.regtest.config.TestProperties.getTestNGRoot(TestProperties.java:123)
>> at com.sun.javatest.regtest.config.RegressionTestFinder.scanFile(RegressionTestFinder.java:143)
>> at com.sun.javatest.finder.TagTestFinder.scan(TagTestFinder.java:115)
>> at com.sun.javatest.TestFinder.read(TestFinder.java:433)
>> at com.sun.javatest.TRT_TreeNode.processFile(TRT_TreeNode.java:1259)
>> at com.sun.javatest.TRT_TreeNode.scanIfNeeded(TRT_TreeNode.java:807)
>> at com.sun.javatest.TRT_TreeNode.getTreeNode(TRT_TreeNode.java:616)
>> at com.sun.javatest.TestResultTable.findNode(TestResultTable.java:400)
>> at com.sun.javatest.TestResultTable.lookupNode(TestResultTable.java:533)
>> at com.sun.javatest.TestResultTable.lookupInitURL(TestResultTable.java:571)
>> at com.sun.javatest.TestResultTable.validatePath(TestResultTable.java:1000)
>> at com.sun.javatest.regtest.config.TestManager.validatePath(TestManager.java:299)
>> at com.sun.javatest.regtest.config.TestManager.getTests(TestManager.java:271)
>> at com.sun.javatest.regtest.tool.Tool.createParameters(Tool.java:1659)
>> at com.sun.javatest.regtest.tool.Tool.run(Tool.java:1293)
>> at com.sun.javatest.regtest.tool.Tool.run(Tool.java:1082)
>> at com.sun.javatest.regtest.tool.Tool.main(Tool.java:155)
>> at com.sun.javatest.regtest.Main.main(Main.java:46)
>>
>>
>> Some debug output showing the problem:
>>
>> scanIfNeeded getRootRelativePath= separator=/ filesToScan[i]=resultdir
>> processFile file=/resultdir isAbsolute=true
>> TestFinder.java read file=/resultdir isAbsolute=true
>> scanFile caller file=/resultdir
>> scanFile File=/resultdir
>> TestProperties.java:dir=/ rootDir=/home/azul/azul/zulu11-git/test/hotspot/jtreg file2=/resultdir file2.getParentFile()=/
>> TestProperties.java:dir=null rootDir=/home/azul/azul/zulu11-git/test/hotspot/jtreg file2=/resultdir file2.getParentFile()=/
>>
>> This happens with jtreg using `-w:resultdir` . `getRootRelativePath()` returns empty `""` path. Other option would be to return `"."` but in such case it broke some other code.
>>
>> This problem does not happen during a single run. It happens only when jtreg is being run in parallel, in my case:
>>
>> seq 1 100000|xargs -n1 -P64 ./runtest
>> #! /bin/bash
>> dir=result-test$$
>> rm -rf $dir
>> mkdir $dir
>> set -o pipefail
>> (JAVA_HOME=$HOME/azul/zulu11-git/build/linux-x86_64-normal-server-release/images/jdk/; $JAVA_HOME/bin/java -classpath $HOME/azul/jtreg/build/images/jtreg/lib/jtreg.jar:$HOME/azul/jtreg/build/images/jtreg/lib/javatest.jar:$HOME/azul/jtreg/build/images/jtreg/lib/asmtools.jar com.sun.javatest.regtest.Main -testjdk:$JAVA_HOME -othervm -verbose -ignore:quiet -retain:all -a -conc:1 -timeout:10 -vmoptions:-XX:+UnlockExperimentalVMOptions -w:$dir -noreport -dir:$JAVA_HOME/../../../../test/jdk/ -nativepath:$JAVA_HOME/../test/hotspot/jtreg/native ../hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java |& tee $dir/err) || exit 255
>> rm -rf $dir
>>
>>
>> Unforunately I am not yet Author so I do not yet have a JBS account so I cannot file it to JBS (Java Bug System).
>
> Jan Kratochvil has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains one additional commit since the last revision:
>
> Fix NullPointerException on a parallel run
>
> Error: Unexpected exception occurred! java.lang.NullPointerException
> java.lang.NullPointerException
> at com.sun.javatest.regtest.config.TestProperties$Cache.getEntryInternal(TestProperties.java:515)
> at com.sun.javatest.regtest.config.TestProperties$Cache.getEntryInternal(TestProperties.java:515)
> at com.sun.javatest.regtest.config.TestProperties$Cache.getEntry(TestProperties.java:502)
> at com.sun.javatest.regtest.config.TestProperties.getEntry(TestProperties.java:170)
> at com.sun.javatest.regtest.config.TestProperties.getTestNGRoot(TestProperties.java:123)
> at com.sun.javatest.regtest.config.RegressionTestFinder.scanFile(RegressionTestFinder.java:143)
> at com.sun.javatest.finder.TagTestFinder.scan(TagTestFinder.java:115)
> at com.sun.javatest.TestFinder.read(TestFinder.java:433)
> at com.sun.javatest.TRT_TreeNode.processFile(TRT_TreeNode.java:1259)
> at com.sun.javatest.TRT_TreeNode.scanIfNeeded(TRT_TreeNode.java:807)
> at com.sun.javatest.TRT_TreeNode.getTreeNode(TRT_TreeNode.java:616)
> at com.sun.javatest.TestResultTable.findNode(TestResultTable.java:400)
> at com.sun.javatest.TestResultTable.lookupNode(TestResultTable.java:533)
> at com.sun.javatest.TestResultTable.lookupInitURL(TestResultTable.java:571)
> at com.sun.javatest.TestResultTable.validatePath(TestResultTable.java:1000)
> at com.sun.javatest.regtest.config.TestManager.validatePath(TestManager.java:299)
> at com.sun.javatest.regtest.config.TestManager.getTests(TestManager.java:271)
> at com.sun.javatest.regtest.tool.Tool.createParameters(Tool.java:1659)
> at com.sun.javatest.regtest.tool.Tool.run(Tool.java:1293)
> at com.sun.javatest.regtest.tool.Tool.run(Tool.java:1082)
> at com.sun.javatest.regtest.tool.Tool.main(Tool.java:155)
> at com.sun.javatest.regtest.Main.main(Main.java:46)
>
> Some debug output showing the problem:
> scanIfNeeded getRootRelativePath= separator=/ filesToScan[i]=resultdir
> processFile file=/resultdir isAbsolute=true
> TestFinder.java read file=/resultdir isAbsolute=true
> scanFile caller file=/resultdir
> scanFile File=/resultdir
> TestProperties.java:dir=/ rootDir=/home/azul/azul/zulu11-git/test/hotspot/jtreg file2=/resultdir file2.getParentFile()=/
> TestProperties.java:dir=null rootDir=/home/azul/azul/zulu11-git/test/hotspot/jtreg file2=/resultdir file2.getParentFile()=/
>
> This happens with jtreg using -w:resultdir . getRootRelativePath()
> returns empty "" path. Other option would be to return "." but in such
> case it broke some other code.
>
> This problem does not happen during a single run. It happens only when
> jtreg is being run in parallel, in my case:
> seq 1 100000|xargs -n1 -P64 ./runtest
> #! /bin/bash
> dir=result-test$$
> rm -rf $dir
> mkdir $dir
> set -o pipefail
> (JAVA_HOME=$HOME/azul/zulu11-git/build/linux-x86_64-normal-server-release/images/jdk/; $JAVA_HOME/bin/java -classpath $HOME/azul/jtreg/build/images/jtreg/lib/jtreg.jar:$HOME/azul/jtreg/build/images/jtreg/lib/javatest.jar:$HOME/azul/jtreg/build/images/jtreg/lib/asmtools.jar com.sun.javatest.regtest.Main -testjdk:$JAVA_HOME -othervm -verbose -ignore:quiet -retain:all -a -conc:1 -timeout:10 -vmoptions:-XX:+UnlockExperimentalVMOptions -w:$dir -noreport -dir:$JAVA_HOME/../../../../test/jdk/ -nativepath:$JAVA_HOME/../test/hotspot/jtreg/native ../hotspot/jtreg/vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java |& tee $dir/err) || exit 255
> rm -rf $dir
src/com/sun/javatest/TRT_TreeNode.java line 809:
> 807: if (path != "")
> 808: path += File.separator;
> 809: processFile(new File(path + filesToScan[i]));
Thanks for the suggested patch. I'd like suggest a bit more compact and direct, e.g.:
String path = TestResultTable.getRootRelativePath(this);
processFile(new File( "".equals(path) // Zero length string if the node is a root
? filesToScan[i] : (path + File.separator + filesToScan[i]) ));
-------------
PR: https://git.openjdk.org/jtharness/pull/35
More information about the jtharness-dev
mailing list