You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2015/11/23 06:52:46 UTC

[Bug 58635] New: Break point at java agent code is ignored during catalina.sh jpda run

https://bz.apache.org/bugzilla/show_bug.cgi?id=58635

            Bug ID: 58635
           Summary: Break point at java agent code is ignored during
                    catalina.sh jpda run
           Product: Tomcat 9
           Version: 9.0.0.M1
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: huxing.zhang@gmail.com

Steps to reproduce this issue:
1. prepare a simple java agent, named TestJavaAgent
2. add a break point to the premain method of TestJavaAgent
3. modify bin/setenv.sh:
export JPDA_SUSPEND=y
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/test/java/agent.jar"
4. start tomcat in debugging mode: 
bin/catalina.sh jpda run 

Expected behavior:
The tomcat prompts "Listening for transport dt_socket at address: 8000", and
when attach a debugger to port 8000, the process stops at the break point in
premain method of TestJavaAgent

Actual behavior:
The premain method of TestJavaAgent has been executed, and then tomcat prompts
"Listening for transport dt_socket at address: 8000", the process never stopped
at the break point in premain method of TestJavaAgent

Putting $JPDA_OPTS before $CATALINA_OPTS will solve this issue:

Index: bin/catalina.sh
===================================================================
--- bin/catalina.sh    (revision 1715719)
+++ bin/catalina.sh    (working copy)
@@ -279,7 +279,7 @@
   if [ -z "$JPDA_OPTS" ]; then
    
JPDA_OPTS="-agentlib:jdwp=transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND"
   fi
-  CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"
+  CATALINA_OPTS="$JPDA_OPTS $CATALINA_OPTS"
   shift
 fi

Note: setting -agentlib=/path/to/agent.jar to JAVA_OPTS won't fix this issue,
neither. Because JAVA_OPTS always goes before CATALINA_OPTS.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 58635] Break point at java agent code is ignored during catalina.sh jpda run

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58635

--- Comment #2 from Huxing Zhang <hu...@gmail.com> ---
I've thought about it, but I am too busy to provide such a for patch for
windows. Thanks for your quick work. :)
>From next time I will consider both cases.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 58635] Break point at java agent code is ignored during catalina.sh jpda run

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=58635

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report and patch. Do keep in mind when working on scripts that
you need to consider the Windows scripts as well.

This has been fixed in 9.0.x for 9.0.0.M2 onwards, 8.0.x for 8.0.30 onwards,
7.0.x for 7.0.66 onwards and 6.0.x for 6.0.45 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org