Mercurial > hg > graal-jvmci-8
comparison src/share/vm/services/threadService.cpp @ 10985:ef748153ee8f
8016304: ThreadMXBean.getDeadlockedThreads reports bogus deadlocks on JDK 8
Reviewed-by: dcubed, mgronlun
author | sla |
---|---|
date | Mon, 17 Jun 2013 18:35:44 +0200 |
parents | 5ee250974db9 |
children | 0b9ea9a72436 |
comparison
equal
deleted
inserted
replaced
10984:cd2118b62475 | 10985:ef748153ee8f |
---|---|
325 waitingToLockBlocker = jt->current_park_blocker(); | 325 waitingToLockBlocker = jt->current_park_blocker(); |
326 } | 326 } |
327 while (waitingToLockMonitor != NULL || waitingToLockBlocker != NULL) { | 327 while (waitingToLockMonitor != NULL || waitingToLockBlocker != NULL) { |
328 cycle->add_thread(currentThread); | 328 cycle->add_thread(currentThread); |
329 if (waitingToLockMonitor != NULL) { | 329 if (waitingToLockMonitor != NULL) { |
330 currentThread = Threads::owning_thread_from_monitor_owner( | 330 address currentOwner = (address)waitingToLockMonitor->owner(); |
331 (address)waitingToLockMonitor->owner(), | 331 if (currentOwner != NULL) { |
332 false /* no locking needed */); | 332 currentThread = Threads::owning_thread_from_monitor_owner( |
333 if (currentThread == NULL) { | 333 currentOwner, |
334 // This function is called at a safepoint so the JavaThread | 334 false /* no locking needed */); |
335 // that owns waitingToLockMonitor should be findable, but | 335 if (currentThread == NULL) { |
336 // if it is not findable, then the previous currentThread is | 336 // This function is called at a safepoint so the JavaThread |
337 // blocked permanently. We record this as a deadlock. | 337 // that owns waitingToLockMonitor should be findable, but |
338 num_deadlocks++; | 338 // if it is not findable, then the previous currentThread is |
339 | 339 // blocked permanently. We record this as a deadlock. |
340 cycle->set_deadlock(true); | 340 num_deadlocks++; |
341 | 341 |
342 // add this cycle to the deadlocks list | 342 cycle->set_deadlock(true); |
343 if (deadlocks == NULL) { | 343 |
344 deadlocks = cycle; | 344 // add this cycle to the deadlocks list |
345 } else { | 345 if (deadlocks == NULL) { |
346 last->set_next(cycle); | 346 deadlocks = cycle; |
347 } else { | |
348 last->set_next(cycle); | |
349 } | |
350 last = cycle; | |
351 cycle = new DeadlockCycle(); | |
352 break; | |
347 } | 353 } |
348 last = cycle; | |
349 cycle = new DeadlockCycle(); | |
350 break; | |
351 } | 354 } |
352 } else { | 355 } else { |
353 if (concurrent_locks) { | 356 if (concurrent_locks) { |
354 if (waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass())) { | 357 if (waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass())) { |
355 oop threadObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker); | 358 oop threadObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker); |