Skip to content

Commit 9638050

Browse files
committed
8360312: Serviceability Agent tests fail with JFR enabled due to unknown thread type JfrRecorderThread
Reviewed-by: kevinw, sspitsyn Backport-of: 712d866b72b43c839c57c3303dfb215f94c0db3b
1 parent 9b99ed8 commit 9638050

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@
3636
#include "utilities/preserveException.hpp"
3737
#include "utilities/macros.hpp"
3838

39-
class JfrRecorderThread : public JavaThread {
40-
public:
41-
JfrRecorderThread(ThreadFunction entry_point) : JavaThread(entry_point) {}
42-
virtual ~JfrRecorderThread() {}
43-
44-
virtual bool is_JfrRecorder_thread() const { return true; }
45-
};
46-
4739
static Thread* start_thread(instanceHandle thread_oop, ThreadFunction proc, TRAPS) {
4840
assert(thread_oop.not_null(), "invariant");
4941
assert(proc != nullptr, "invariant");

src/hotspot/share/jfr/recorder/service/jfrRecorderThread.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
#define SHARE_JFR_RECORDER_SERVICE_JFRRECORDERTHREAD_HPP
2727

2828
#include "memory/allStatic.hpp"
29+
#include "runtime/javaThread.hpp"
2930
#include "utilities/debug.hpp"
3031

31-
class JavaThread;
3232
class JfrCheckpointManager;
3333
class JfrPostBox;
3434
class Thread;
@@ -42,4 +42,12 @@ class JfrRecorderThreadEntry : AllStatic {
4242
static bool start(JfrCheckpointManager* cp_manager, JfrPostBox* post_box, TRAPS);
4343
};
4444

45+
class JfrRecorderThread : public JavaThread {
46+
public:
47+
JfrRecorderThread(ThreadFunction entry_point) : JavaThread(entry_point) {}
48+
virtual ~JfrRecorderThread() {}
49+
50+
virtual bool is_JfrRecorder_thread() const { return true; }
51+
};
52+
4553
#endif // SHARE_JFR_RECORDER_SERVICE_JFRRECORDERTHREAD_HPP

src/hotspot/share/runtime/vmStructs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#include "gc/shared/vmStructs_gc.hpp"
4545
#include "interpreter/bytecodes.hpp"
4646
#include "interpreter/interpreter.hpp"
47+
#include "jfr/recorder/service/jfrRecorderThread.hpp"
4748
#include "logging/logAsyncWriter.hpp"
4849
#include "memory/allocation.hpp"
4950
#include "memory/allocation.inline.hpp"
@@ -1027,6 +1028,7 @@
10271028
declare_type(TrainingReplayThread, JavaThread) \
10281029
declare_type(StringDedupThread, JavaThread) \
10291030
declare_type(AttachListenerThread, JavaThread) \
1031+
declare_type(JfrRecorderThread, JavaThread) \
10301032
DEBUG_ONLY(COMPILER2_OR_JVMCI_PRESENT( \
10311033
declare_type(DeoptimizeObjectsALotThread, JavaThread))) \
10321034
declare_toplevel_type(OSThread) \

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Threads.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ private static synchronized void initialize(TypeDataBase db) {
158158
virtualConstructor.addMapping("JvmtiAgentThread", JavaThread.class);
159159
virtualConstructor.addMapping("NotificationThread", JavaThread.class);
160160
virtualConstructor.addMapping("AttachListenerThread", JavaThread.class);
161+
virtualConstructor.addMapping("JfrRecorderThread", JavaThread.class);
161162

162163
// These are all the hidden JavaThread subclasses that don't execute java code.
163164
virtualConstructor.addMapping("StringDedupThread", HiddenJavaThread.class);
@@ -195,7 +196,8 @@ public JavaThread createJavaThreadWrapper(Address threadAddr) {
195196
} catch (Exception e) {
196197
throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
197198
" (expected type JavaThread, CompilerThread, MonitorDeflationThread, AttachListenerThread," +
198-
" DeoptimizeObjectsALotThread, StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)", e);
199+
" DeoptimizeObjectsALotThread, StringDedupThread, NotificationThread, ServiceThread," +
200+
" JfrRecorderThread, or JvmtiAgentThread)", e);
199201
}
200202
}
201203

test/hotspot/jtreg/serviceability/sa/ClhsdbJstackWithConcurrentLock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@ public static void main(String[] args) throws Exception {
4646

4747
theApp = new LingeredAppWithConcurrentLock();
4848
// Use a small heap so the scan is quick.
49-
LingeredApp.startApp(theApp, "-Xmx4m");
49+
LingeredApp.startApp(theApp, "-Xmx8m");
5050
System.out.println("Started LingeredApp with pid " + theApp.getPid());
5151

5252
// Run the 'jstack -l' command to get the stack and have java.util.concurrent

0 commit comments

Comments
 (0)