8129348: Debugger hangs in trace mode with TRACE_SENDS
authorkevinw
Thu, 29 Oct 2015 05:24:30 -0700
changeset 33834 fc9527f5a30f
parent 33833 664fe50d031d
child 33835 8cfbdfc35f82
8129348: Debugger hangs in trace mode with TRACE_SENDS Reviewed-by: sspitsyn Contributed-by: cheleswer.sahu@oracle.com
jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java	Thu Oct 29 21:38:11 2015 -0400
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java	Thu Oct 29 05:24:30 2015 -0700
@@ -236,6 +236,15 @@
                                            final MethodImpl method,
                                            final ValueImpl[] args,
                                            final int options) {
+        /*
+         * Cache the values of args when TRACE_SENDS is enabled, for later printing.
+         * If not cached, printing causes a remote call while synchronized, and deadlock.
+         */
+        if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {
+           for (ValueImpl arg: args) {
+              arg.toString();
+           }
+        }
         CommandSender sender = getInvokeMethodSender(thread, method, args, options);
         PacketStream stream;
         if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {