summaryrefslogtreecommitdiff
path: root/runtime/native/java_lang_Thread.cc
diff options
context:
space:
mode:
authorHans Boehm <hboehm@google.com>2021-05-21 09:23:38 -0700
committerNicolas Geoffray <ngeoffray@google.com>2021-09-04 13:18:05 +0000
commit1363c1bf72f25f088b1f83250e91a47fc8cc7173 (patch)
tree2660c9c7b13b6f9829c0aa41a54815a20709c635 /runtime/native/java_lang_Thread.cc
parentd971d7e57687e51071583cbcb2acaabf8cdb6074 (diff)
Improve suspension timeout diagnostic and fix race
Fix a data race on state_and_flags. Since the access was volatile and there are system calls in the loop, this is extremely unlikey to have casused the bug here, but ... So, assuming this is still broken, produce more informative output once we time out. Remove unused argument from SuspendThreadByPeer(). It made the logic more complicated and made it harder to reason about correctness. Remove dead code after LOG(FATAL, ...) Bug: 181778559 Test: TreeHugger, temporarily paste log message into hotter path. Merged-In: I6f3455925b3a3f4726a870150aeb54ea60a38d67 (cherry picked from commit 9d27fbc8ced914f4726187920a7794b07eca3e71) Change-Id: Ia3f04153fb0a4f1b899fb0f68a6121728f89cb91 (cherry picked from commit 116203735734738cbfdffc2163b08b1707089f9c)
Diffstat (limited to 'runtime/native/java_lang_Thread.cc')
-rw-r--r--runtime/native/java_lang_Thread.cc1
1 files changed, 0 insertions, 1 deletions
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
index 37b3fe642e..c3b4fe09de 100644
--- a/runtime/native/java_lang_Thread.cc
+++ b/runtime/native/java_lang_Thread.cc
@@ -148,7 +148,6 @@ static void Thread_setNativeName(JNIEnv* env, jobject peer, jstring java_name) {
bool timed_out;
// Take suspend thread lock to avoid races with threads trying to suspend this one.
Thread* thread = thread_list->SuspendThreadByPeer(peer,
- /* request_suspension= */ true,
SuspendReason::kInternal,
&timed_out);
if (thread != nullptr) {