RFR: Fix NullPointerException on a parallel run [v2]

Jan Kratochvil duke at openjdk.org
Thu Aug 18 07:55:05 UTC 2022


> 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 pull request now contains one commit:

  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

-------------

Changes: https://git.openjdk.org/jtharness/pull/35/files
 Webrev: https://webrevs.openjdk.org/?repo=jtharness&pr=35&range=01
  Stats: 4 lines in 1 file changed: 2 ins; 0 del; 2 mod
  Patch: https://git.openjdk.org/jtharness/pull/35.diff
  Fetch: git fetch https://git.openjdk.org/jtharness pull/35/head:pull/35

PR: https://git.openjdk.org/jtharness/pull/35


More information about the jtharness-dev mailing list