diff options
author | Egor.Ushakov <egor.ushakov@jetbrains.com> | 2017-03-10 16:22:21 +0300 |
---|---|---|
committer | Egor.Ushakov <egor.ushakov@jetbrains.com> | 2017-03-10 16:22:21 +0300 |
commit | 8500ba524ee2ac592b1ad9d9f09d2a62c92d1d0e (patch) | |
tree | f99ed91e8a85b6b511c9d3e6add6f2e02a837626 | |
parent | a09b77362c24427e716bea5930332b0d5a0dac05 (diff) | |
download | jdk8u_jdk-8500ba524ee2ac592b1ad9d9f09d2a62c92d1d0e.tar.gz |
8134103: JVMTI_ERROR_WRONG_PHASE(112): on checking for an interfacejb8u112-b773
Summary: Add guards to the jdwp agent shutdown
Reviewed-by: dholmes, dcubed, dsamersoff
(from jdk10)
-rw-r--r-- | src/share/back/debugLoop.c | 14 | ||||
-rw-r--r-- | src/share/back/eventHelper.c | 8 |
2 files changed, 9 insertions, 13 deletions
diff --git a/src/share/back/debugLoop.c b/src/share/back/debugLoop.c index f49b53c7a6..5c9428f121 100644 --- a/src/share/back/debugLoop.c +++ b/src/share/back/debugLoop.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -125,15 +125,13 @@ debugLoop_run(void) jboolean replyToSender = JNI_TRUE; /* - * For VirtualMachine commands we hold the vmDeathLock + * For all commands we hold the vmDeathLock * while executing and replying to the command. This ensures - * that a VM command after VM_DEATH will be allowed to complete + * that a command after VM_DEATH will be allowed to complete * before the thread posting the VM_DEATH continues VM * termination. */ - if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){ - debugMonitorEnter(vmDeathLock); - } + debugMonitorEnter(vmDeathLock); /* Initialize the input and output streams */ inStream_init(&in, p); @@ -172,9 +170,7 @@ debugLoop_run(void) /* * Release the vmDeathLock as the reply has been posted. */ - if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){ - debugMonitorExit(vmDeathLock); - } + debugMonitorExit(vmDeathLock); inStream_destroy(&in); outStream_destroy(&out); diff --git a/src/share/back/eventHelper.c b/src/share/back/eventHelper.c index a17a091aa3..bd5f080ba3 100644 --- a/src/share/back/eventHelper.c +++ b/src/share/back/eventHelper.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -240,10 +240,10 @@ dequeueCommand(void) size = commandSize(command); /* - * Immediately close out any commands enqueued from a - * previously attached debugger. + * Immediately close out any commands enqueued from + * a dead VM or a previously attached debugger. */ - if (command->sessionID != currentSessionID) { + if (gdata->vmDead || command->sessionID != currentSessionID) { log_debugee_location("dequeueCommand(): command session removal", NULL, NULL, 0); completeCommand(command); command = NULL; |