Skip to content

8360312: Serviceability Agent tests fail with JFR enabled due to unknown thread type JfrRecorderThread #25960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/hotspot/share/jfr/recorder/service/jfrRecorderThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
#include "utilities/preserveException.hpp"
#include "utilities/macros.hpp"

class JfrRecorderThread : public JavaThread {
public:
JfrRecorderThread(ThreadFunction entry_point) : JavaThread(entry_point) {}
virtual ~JfrRecorderThread() {}

virtual bool is_JfrRecorder_thread() const { return true; }
};

static Thread* start_thread(instanceHandle thread_oop, ThreadFunction proc, TRAPS) {
assert(thread_oop.not_null(), "invariant");
assert(proc != nullptr, "invariant");
Expand Down
10 changes: 9 additions & 1 deletion src/hotspot/share/jfr/recorder/service/jfrRecorderThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#define SHARE_JFR_RECORDER_SERVICE_JFRRECORDERTHREAD_HPP

#include "memory/allStatic.hpp"
#include "runtime/javaThread.hpp"
#include "utilities/debug.hpp"

class JavaThread;
class JfrCheckpointManager;
class JfrPostBox;
class Thread;
Expand All @@ -42,4 +42,12 @@ class JfrRecorderThreadEntry : AllStatic {
static bool start(JfrCheckpointManager* cp_manager, JfrPostBox* post_box, TRAPS);
};

class JfrRecorderThread : public JavaThread {
public:
JfrRecorderThread(ThreadFunction entry_point) : JavaThread(entry_point) {}
virtual ~JfrRecorderThread() {}

virtual bool is_JfrRecorder_thread() const { return true; }
};

#endif // SHARE_JFR_RECORDER_SERVICE_JFRRECORDERTHREAD_HPP
2 changes: 2 additions & 0 deletions src/hotspot/share/runtime/vmStructs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "gc/shared/vmStructs_gc.hpp"
#include "interpreter/bytecodes.hpp"
#include "interpreter/interpreter.hpp"
#include "jfr/recorder/service/jfrRecorderThread.hpp"
#include "logging/logAsyncWriter.hpp"
#include "memory/allocation.hpp"
#include "memory/allocation.inline.hpp"
Expand Down Expand Up @@ -1027,6 +1028,7 @@
declare_type(TrainingReplayThread, JavaThread) \
declare_type(StringDedupThread, JavaThread) \
declare_type(AttachListenerThread, JavaThread) \
declare_type(JfrRecorderThread, JavaThread) \
DEBUG_ONLY(COMPILER2_OR_JVMCI_PRESENT( \
declare_type(DeoptimizeObjectsALotThread, JavaThread))) \
declare_toplevel_type(OSThread) \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ private static synchronized void initialize(TypeDataBase db) {
virtualConstructor.addMapping("JvmtiAgentThread", JavaThread.class);
virtualConstructor.addMapping("NotificationThread", JavaThread.class);
virtualConstructor.addMapping("AttachListenerThread", JavaThread.class);
virtualConstructor.addMapping("JfrRecorderThread", JavaThread.class);

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2024, 2025, 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
Expand Down Expand Up @@ -46,7 +46,7 @@ public static void main(String[] args) throws Exception {

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

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