Skip to content

Commit

Permalink
Log warning if thread is blocked.
Browse files Browse the repository at this point in the history
Improve log layout
  • Loading branch information
HenrikJannsen committed Oct 5, 2024
1 parent 952068c commit 4ed0907
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions common/src/main/java/bisq/common/platform/MemoryReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ public void logReport() {
}

ThreadProfiler threadProfiler = ThreadProfiler.INSTANCE;
int nameLength = 120;
String format = "%-5s\t %-8s\t %-" + nameLength + "s \t %-15s\t %-15s\t %-15s\n";
int nameLength = 80;
String format = "%-5s\t %-8s\t %-" + nameLength + "s\t %-15s\t %-15s\t %-15s\n";
String header = String.format(format, "ID", "Priority", "[Group] Name", "State", "Time", "Memory");

StringBuilder customBisqThreads = new StringBuilder("Bisq custom threads:\n");
Expand All @@ -93,11 +93,16 @@ public void logReport() {
.map(DataSizeFormatter::format)
.orElse("N/A");
int priority = thread.getPriority();
String threadState = thread.getState().name();
if (threadState.equals("BLOCKED")) {
log.warn("Thread {} is in {} state. It might be caused by a deadlock or resource block. " +
"thread={}", thread.threadId(), threadState, thread);
}
String line = String.format(format,
thread.threadId(),
priority,
fullName,
thread.getState().name(),
threadState,
time,
memory
);
Expand Down

0 comments on commit 4ed0907

Please sign in to comment.