summaryrefslogtreecommitdiffstats
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-08-18 19:26:39 +0200
committerSebastien Hertz <shertz@google.com>2014-08-19 11:38:49 +0200
commitc6345efb56f9096c4b1a1a90e1d8d847fc01d910 (patch)
treee0be48d4d581d9a72b5cb9b45b0fed6f8b778d07 /runtime/debugger.cc
parent562f0ef60bb1498fdf3c43fe747ba067ffe6ebed (diff)
downloadart-c6345efb56f9096c4b1a1a90e1d8d847fc01d910.zip
art-c6345efb56f9096c4b1a1a90e1d8d847fc01d910.tar.gz
art-c6345efb56f9096c4b1a1a90e1d8d847fc01d910.tar.bz2
Fix JDWP event races
Fix a race where the JDWP connection could be closed before the VM_DEATH event is sent during runtime shutdown. Fix potential race where we could wait forever for the JDWP thread to establish connection. Bug: 16720689 (cherry picked from commit d8b3537b89fa68599534a65afc3b272639cd4a75) Change-Id: I4b8996ade6a38fa8f7f23c3000b7184b162907d7
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 1cddb8b..6d2f21e 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -664,6 +664,11 @@ void Dbg::StartJdwp() {
}
void Dbg::StopJdwp() {
+ // Post VM_DEATH event before the JDWP connection is closed (either by the JDWP thread or the
+ // destruction of gJdwpState).
+ if (gJdwpState != nullptr && gJdwpState->IsActive()) {
+ gJdwpState->PostVMDeath();
+ }
// Prevent the JDWP thread from processing JDWP incoming packets after we close the connection.
Disposed();
delete gJdwpState;