JDK-8284027 : vmTestbase/nsk/jvmti/GetAllThreads/allthr001/ is failing
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: repo-loom
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-03-30
  • Updated: 2022-12-16
  • Resolved: 2022-05-05
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.
JDK 19
19 b22Fixed
Related Reports
Blocks :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8297083 :  
Description
----------System.out:(5/214)----------
# Waiting time = 5 mins
Point 1: number of threads expected: 8, got: 9
Point 2: number of threads expected: 9, got: 10
Point 3: number of threads expected: 8, got: 9
Point 4: number of threads expected: 9, got: 10

The cause seems to be the changes in the following commit, which reworked how/when carrier threads are created:

https://github.com/openjdk/loom/commit/d528caa6c9b961f399362d66c65aafb339751c4f

The end result is carrier threads are still being created while the test is running, so it ends up with an unexpected extra thread. The test uses isThreadExpected() to filter out unexpected thread creations, but it currently does not filter out carrier threads. I tried fixing it to do so, but that causes the following two tests to fail due to JDK-8284028:

vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/TestDescription.java	
vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/TestDescription.java	

So the fix is on hold until that bug is fixed.
Comments
Changeset: 1bba6407 Author: Alex Menkov <amenkov@openjdk.org> Date: 2022-05-05 19:41:41 +0000 URL: https://git.openjdk.java.net/jdk/commit/1bba64070e03ae3e047dc70dca75caeb49813908
05-05-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/8512 Date: 2022-05-02 23:20:52 +0000
02-05-2022

The test counts all "system" threads before the execution and expects that this number remains the same during test execution. This makes the test fragile - JVM may start internal threads, some threads may end (like UT thread). I think this strong condition should be removed. The test should checks only test threads, and verify that the live threads are reported by GetAllThreads and terminated threads are not reported.
29-04-2022

The following diff fixes the issue, but can't be pushed until JDK-8284028 is resolved: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp index fae205bd86e..0ce0fe06508 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -587,7 +587,11 @@ int isThreadExpected(jvmtiEnv *jvmti, jthread thread) { static const char *graal_management_bean_registration_thread_name = "HotSpotGraalManagement Bean Registration"; static const char *graal_compiler_thread_name_prefix = "JVMCI CompilerThread"; - static const size_t prefixLength = strlen(graal_compiler_thread_name_prefix); + static const size_t graal_compiler_thread_name_prefix_length = + strlen(graal_compiler_thread_name_prefix); + static const char *forkjoinpool_thread_name_prefix = "ForkJoinPool"; + static const size_t forkjoinpool_thread_name_prefix_length = + strlen(forkjoinpool_thread_name_prefix); jvmtiThreadInfo threadinfo; NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadinfo)); @@ -601,9 +605,15 @@ int isThreadExpected(jvmtiEnv *jvmti, jthread thread) { if (strcmp(threadinfo.name, graal_management_bean_registration_thread_name) == 0) return 0; - if ((strlen(threadinfo.name) > prefixLength) && - strncmp(threadinfo.name, graal_compiler_thread_name_prefix, prefixLength) == 0) + if ((strlen(threadinfo.name) > graal_compiler_thread_name_prefix_length) && + strncmp(threadinfo.name, graal_compiler_thread_name_prefix, + graal_compiler_thread_name_prefix_length) == 0) return 0; + if ((strlen(threadinfo.name) > forkjoinpool_thread_name_prefix_length) && + strncmp(threadinfo.name, forkjoinpool_thread_name_prefix, + forkjoinpool_thread_name_prefix_length) == 0) + return 0; + nsk_printf("isThreadExpected: yes\n"); return 1; }
30-03-2022