JDK-8240781 : serviceability/sa/ClhsdbJdis.java fails with "java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 15
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2020-03-10
  • Updated: 2020-04-23
  • Resolved: 2020-04-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Relates :  
Sub Tasks
JDK-8240782 :  
Description
The test has failed a few times for this reason over the past year, but has for the most part been incorrectly linked to other CRs. Here's the failure:

 LingeredApp stdout: [];
 LingeredApp stderr: []
 LingeredApp exitValue = 0
java.lang.RuntimeException: Test ERROR java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at ClhsdbJdis.main(ClhsdbJdis.java:89)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
	at ClhsdbJdis.main(ClhsdbJdis.java:62)
	... 6 more

Looking at the code:

            String cmdStr = null;
            String[] parts = output.split("LingeredApp.main");
            String[] tokens = parts[1].split(" ");
            for (String token : tokens) {
                if (token.contains("Method")) {
                    String[] address = token.split("=");
                    // address[1] represents the address of the Method
                    cmdStr = "jdis " + address[1];
                    cmds.add(cmdStr);
                    break;
                }
            }

The exception happens on the parts[1] reference. Probably we did not get the expected output. I also saw one case that had the same error on the address[1] reference. A subtask will be created to have this test do a better job of detecting the incomplete output, and report the output when this happens.

Comments
This is a duplicate of JDK-8243455.
23-04-2020

The issue is the same as JDK-8211923 and JDK-8242411. The stack trace for the main thread is missing: "main" #1 prio=5 tid=0x00007f981e00a800 nid=0x2103 runnable [0x0000000000000000] java.lang.Thread.State: RUNNABLE JavaThread state: _thread_in_java So output.split("LingeredApp.main") doesn't do any splitting, and indexing into the 2nd element of the returned array produces the AIOOBE.
15-04-2020