Skip to content

Commit 3ade3b6

Browse files
committed
Try printing thread dump info to tmp files.
1 parent a5f36e4 commit 3ade3b6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

deploy/tasks/buildah-oci-ta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ spec:
552552
-f "$dockerfile_copy" -t "$IMAGE" .
553553
fi
554554
555-
cat /app/thread_dump_*
555+
cat /tmp/thread_dump_*
556556
557557
container=$(buildah from --pull-never "$IMAGE")
558558
buildah mount $container | tee /shared/container_path

java-components/domain-proxy/common/src/main/java/com/redhat/hacbs/domainproxy/common/CommonIOUtil.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ private static String getChannelName(final SocketChannel channel) {
171171
public static void threadDump() throws IOException {
172172
// Create a timestamp with milliseconds for the file name
173173
String timestamp = new SimpleDateFormat("yyyyMMdd_HHmmss_SSS").format(new Date());
174-
String fileName = "/app/thread_dump_" + timestamp + ".txt";
175-
String threadDumpStr = "";
174+
String fileName = "/tmp/thread_dump_" + timestamp + ".txt";
176175

177176
// Create a PrintWriter to write the thread dump to a file
178177
try (PrintWriter writer = new PrintWriter(new FileWriter(fileName))) {
@@ -185,15 +184,16 @@ public static void threadDump() throws IOException {
185184

186185
// Write the thread information to the file
187186
for (ThreadInfo threadInfo : threadInfos) {
188-
threadDumpStr += "Thread ID: " + threadInfo.getThreadId() + " Name: " + threadInfo.getThreadName() + "\n";
189-
threadDumpStr += "Thread State: " + threadInfo.getThreadState() + "\n";
187+
writer.println("Thread ID: " + threadInfo.getThreadId() + " Name: " + threadInfo.getThreadName());
188+
writer.println("Thread State: " + threadInfo.getThreadState());
190189
StackTraceElement[] stackTrace = threadInfo.getStackTrace();
191190
for (StackTraceElement stackTraceElement : stackTrace) {
192-
threadDumpStr += "\t" + stackTraceElement + "\n";
191+
writer.println("\t" + stackTraceElement);
193192
}
193+
writer.println();
194194
}
195195
}
196196

197-
LOG.info(threadDumpStr);
197+
LOG.infof("Thread dump written to file: %s", fileName);
198198
}
199199
}

0 commit comments

Comments
 (0)