You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Dag H. Wanvik (JIRA)" <ji...@apache.org> on 2012/06/15 01:59:42 UTC

[jira] [Created] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Dag H. Wanvik created DERBY-5819:
------------------------------------

             Summary: Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
                 Key: DERBY-5819
                 URL: https://issues.apache.org/jira/browse/DERBY-5819
             Project: Derby
          Issue Type: Improvement
          Components: Test
            Reporter: Dag H. Wanvik
            Priority: Minor


Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:

-Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-5819:
---------------------------------

    Attachment: derby-5819d.diff

Added an other option to control the way the subprocesses are started:

derby.test.debugSuspend=<y|n> default 'y'

Unless this property is 'n', the subprocess will hang till the debugger is connected, cf the explanation here:
http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/conninv.html#Invocation
                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff, derby-5819b.diff, derby-5819c.diff, derby-5819d.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik resolved DERBY-5819.
----------------------------------

    Resolution: Fixed
    
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>             Fix For: 10.10.0.0
>
>         Attachments: derby-5819.diff, derby-5819b.diff, derby-5819c.diff, derby-5819d.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-5819:
---------------------------------

    Attachment: derby-5819b.diff

Attached version "b" of this patch. For now, it limits this to Sun VMs. Added another property, "debugPortBase=<int>", but the default is still 8800. Refactored the code to a private method in BasetestCase: setupForDebuggerAttach.

Summary of properties as the patch stands:

     debugPortBase=<int>    default 8800
     debugSubProcesses=<boolean>    default false 

                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff, derby-5819b.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-5819:
---------------------------------

    Attachment: derby-5819.diff

Here is a crude patch which basically creates debug ports on all started subprocesses from 8800 and upward iff this setting applies in the parent VM:

-DdebugSubprocesses=true

We could parameterize the port offset, and the value for "suspend=?". Defaults could be 8800 and 'y' though. This method probably only applies to Oracle VMs, too, so the code should check for that, I guess.


                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-5819:
---------------------------------

    Attachment: derby-5819c.diff

Uploading a new version of this patch which changes the properties to 

derby.test.debugPortBase=<int> default 8800
derby.test.debugSubProcesses=<boolean> default false 


                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff, derby-5819b.diff, derby-5819c.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik reassigned DERBY-5819:
------------------------------------

    Assignee: Dag H. Wanvik
    
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik closed DERBY-5819.
--------------------------------


Closing. If needed this patch could be backported.
                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>             Fix For: 10.10.0.0
>
>         Attachments: derby-5819.diff, derby-5819b.diff, derby-5819c.diff, derby-5819d.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-5819:
---------------------------------

    Issue & fix info: Patch Available
    
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399732#comment-13399732 ] 

Dag H. Wanvik commented on DERBY-5819:
--------------------------------------

Thanks, Knut. Indeed it would fail, sorry, I uploaded wrong version of the patch.
                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff, derby-5819b.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399252#comment-13399252 ] 

Knut Anders Hatlen commented on DERBY-5819:
-------------------------------------------

This sounds like useful functionality. A couple of comments:

- Maybe the properties should be prefixed with "derby.test." for consistency with the other test properties.

- Won't this check fail with a NullPointerException if the debugSubprocesses property is not set?

+        if (isSunJVM() && "true".equals(
+                getSystemProperty("debugSubprocesses").toLowerCase())) {

(Btw, Boolean.valueOf(String) would save you the trouble of normalizing/lowercasing the value, and it also handles null.)
                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff, derby-5819b.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13405309#comment-13405309 ] 

Dag H. Wanvik commented on DERBY-5819:
--------------------------------------

Committed version d as svn 1356457. Commit log:

Adds options to allow this capability for Oracle Java (properties below
ignored for other implementations):

derby.test.debugPortBase=<int> default 8800
derby.test.debugSubProcesses=<boolean> default false 
derby.test.debugSuspend=<y|n> default 'y' 

If several subprocesses are created, the port for subprocess two will be
debugPortBase + 1 (i.e. 8801 by default) etc.

                
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>         Attachments: derby-5819.diff, derby-5819b.diff, derby-5819c.diff, derby-5819d.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (DERBY-5819) Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-5819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dag H. Wanvik updated DERBY-5819:
---------------------------------

    Issue & fix info:   (was: Patch Available)
       Fix Version/s: 10.10.0.0
    
> Add logic to BaseTestCase to start subprocesses ready to be attached to from a Java debugger
> --------------------------------------------------------------------------------------------
>
>                 Key: DERBY-5819
>                 URL: https://issues.apache.org/jira/browse/DERBY-5819
>             Project: Derby
>          Issue Type: Improvement
>          Components: Test
>            Reporter: Dag H. Wanvik
>            Assignee: Dag H. Wanvik
>            Priority: Minor
>             Fix For: 10.10.0.0
>
>         Attachments: derby-5819.diff, derby-5819b.diff, derby-5819c.diff, derby-5819d.diff
>
>
> Sometimes it's useful to be able to attach to subprocesses of tests with a debugger.
> Now that we have centralized subprocess creation in BaseTestCase#execJavaCmd it would be easy and useful to have subprocesses start, but wait for a debugger to attach to them, i.e. with these options on an Oracle VM:
> -Xdebug -Xrunjdwp:transport=dt_socket,address=<port>,server=y,suspend=y

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira