From 21e729c7859ce7909e85d135f6c9e32bbba38860 Mon Sep 17 00:00:00 2001 From: Sebastien Hertz Date: Tue, 18 Feb 2014 14:16:00 +0100 Subject: Fix failing check during JDWP invoke. Fixes a race where the JDWP thread expects the invoke thread can be suspended (suspend_count != 0) before invoke thread actually updates its suspend count. It happens after the invoke thread signals the JDWP thread to notify invoke is completed but before incrementing its suspend count. In the meantime, the JDWP thread wakes up and checks whether invoke thread has updated its supend count. But there is no way to prevent the JDWP thread to do so before the invoke thread updates its suspend count. We now move the invoke completion code after the suspend count update. Then the JDWP thread wakes up at the right time. Bug: 11247837 Bug: 12578041 Change-Id: Ib6079c6e330671b34217838e26b1e758706d3da6 --- runtime/jdwp/jdwp_event.cc | 8 -------- 1 file changed, 8 deletions(-) (limited to 'runtime/jdwp') diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc index e372c26..677b04b 100644 --- a/runtime/jdwp/jdwp_event.cc +++ b/runtime/jdwp/jdwp_event.cc @@ -576,14 +576,6 @@ void JdwpState::SuspendByPolicy(JdwpSuspendPolicy suspend_policy, JDWP::ObjectId Dbg::ExecuteMethod(pReq); pReq->error = ERR_NONE; - - /* clear this before signaling */ - pReq->invoke_needed = false; - - VLOG(jdwp) << "invoke complete, signaling and self-suspending"; - Thread* self = Thread::Current(); - MutexLock mu(self, pReq->lock); - pReq->cond.Signal(self); } } -- cgit v1.1