[ 
https://issues.apache.org/jira/browse/GEODE-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16313758#comment-16313758
 ] 

ASF GitHub Bot commented on GEODE-4221:
---------------------------------------

jhuynh1 closed pull request #1234: GEODE-4221: Restore the ability to access 
the debugging VM.
URL: https://github.com/apache/geode/pull/1234
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
 
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
index f956c6b74e..ca6a6237e6 100644
--- 
a/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
+++ 
b/geode-core/src/test/java/org/apache/geode/test/dunit/standalone/DUnitLauncher.java
@@ -62,7 +62,6 @@
 import org.apache.geode.distributed.internal.InternalLocator;
 import 
org.apache.geode.distributed.internal.membership.gms.membership.GMSJoinLeave;
 import org.apache.geode.internal.AvailablePortHelper;
-import org.apache.geode.internal.Version;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.test.dunit.DUnitEnv;
 import org.apache.geode.test.dunit.Host;
@@ -96,8 +95,19 @@
 
   static int locatorPort;
 
+  /**
+   * Number of VMs to use during initialization.
+   */
   public static final int NUM_VMS = 4;
+
+  /**
+   * VM ID for the VM to use for the debugger.
+   */
   private static final int DEBUGGING_VM_NUM = -1;
+
+  /**
+   * VM ID for the VM to use for the locator.
+   */
   private static final int LOCATOR_VM_NUM = -2;
 
   static final long STARTUP_TIMEOUT = 120 * 1000;
@@ -484,12 +494,17 @@ public void init(Registry registry, int numVMs)
     }
 
     /**
-     * this will not bounce VM to a different version. It will only get the 
current running VM or
-     * launch a new one if not already launched.
+     * Retrieves one of this host's VMs based on the specified VM ID. This 
will not bounce VM to a
+     * different version. It will only get the current running VM or launch a 
new one if not already
+     * launched.
+     *
+     * @param n ID of the requested VM; a value of <code>-1</code> will return 
the controller VM,
+     *        which may be useful for debugging.
+     * @return VM for the requested VM ID.
      */
     @Override
     public VM getVM(int n) {
-      if (n < getVMCount()) {
+      if (n < getVMCount() && n != DEBUGGING_VM_NUM) {
         VM current = super.getVM(n);
         return getVM(current.getVersion(), n);
       } else {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Unable to debug non-controller VMs in DUnit tests
> -------------------------------------------------
>
>                 Key: GEODE-4221
>                 URL: https://issues.apache.org/jira/browse/GEODE-4221
>             Project: Geode
>          Issue Type: Bug
>          Components: tests
>            Reporter: Michael Dodge
>            Assignee: Michael Dodge
>
> An easy mechanism for debugging code that would normally run in a 
> non-controller VM in DUnit tests is to temporarily modify the test to pass 
> {{-1}} to {{Host.getVM()}} _instead of_  a non-negative VM ID as would 
> normally be used. Unfortunately, this mechanism now results in a 
> {{java.lang.ArrayIndexOutOfBoundsException}} due to changes for GEODE-3985. 
> {{DUnitLauncher.getVM(int n)}} needs to be modified to restore the use of 
> {{-1}} for debugging.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to