Exclude the HeapTaskDaemon from blocked thread warnings.
It's just how the thing works in a lot of cases, and it's polluting the logs with instances of nothing but several blocked HeapTaskDaemons.
This commit is contained in:
parent
ba0befde20
commit
f0a4956cdd
1 changed files with 10 additions and 5 deletions
|
@ -27,12 +27,15 @@ class DeadlockDetector(private val handler: Handler, private val pollingInterval
|
|||
|
||||
private fun poll() {
|
||||
val threads: Map<Thread, Array<StackTraceElement>> = Thread.getAllStackTraces()
|
||||
val blocked: Map<Thread, Array<StackTraceElement>> = threads.filter { entry ->
|
||||
val thread: Thread = entry.key
|
||||
val stack: Array<StackTraceElement> = entry.value
|
||||
val blocked: Map<Thread, Array<StackTraceElement>> = threads
|
||||
.filter { entry ->
|
||||
val thread: Thread = entry.key
|
||||
val stack: Array<StackTraceElement> = entry.value
|
||||
|
||||
thread.state == Thread.State.BLOCKED || (thread.state == Thread.State.WAITING && stack.any { it.methodName.startsWith("lock") })
|
||||
}
|
||||
.filter { entry -> !BLOCK_BLACKLIST.contains(entry.key.name) }
|
||||
|
||||
thread.state == Thread.State.BLOCKED || (thread.state == Thread.State.WAITING && stack.any { it.methodName.startsWith("lock") })
|
||||
}
|
||||
val blockedIds: Set<Long> = blocked.keys.map(Thread::getId).toSet()
|
||||
val stillBlocked: Set<Long> = blockedIds.intersect(previouslyBlocked)
|
||||
|
||||
|
@ -93,6 +96,8 @@ class DeadlockDetector(private val handler: Handler, private val pollingInterval
|
|||
|
||||
private const val CONCERNING_QUEUE_THRESHOLD = 4
|
||||
|
||||
private val BLOCK_BLACKLIST = setOf("HeapTaskDaemon")
|
||||
|
||||
private fun buildLogString(description: String, blocked: Map<Thread, Array<StackTraceElement>>): String {
|
||||
val stringBuilder = StringBuilder()
|
||||
stringBuilder.append(description).append("\n")
|
||||
|
|
Loading…
Add table
Reference in a new issue