RFR: 8202884 [backport]: SA: Attach/detach might fail on Linux if debugee application create/destroy threads during attaching

Andrew John Hughes gnu.andrew at redhat.com
Tue May 28 17:39:23 UTC 2019



On 28/05/2019 16:21, Andrew Dinn wrote:
> I'd like to request a review for a backport of JDK-8202884 to jdk8u. The
> original patch does not apply cleanly. A modified patch is provided here:
> 
> changeset: http://cr.openjdk.java.net/~adinn/8202884/
> 
> regards,
> 
> 
> Andrew Dinn
> -----------
> Senior Principal Software Engineer
> Red Hat UK Ltd
> Registered in England and Wales under Company Registration No. 03798903
> Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
> 

This looks mostly like a clean backport apart from:

11u:

         if (!ptrace_continue(pid, WSTOPSIG(status))) {
           print_error("Failed to correctly attach to VM. VM might HANG!
[PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(statu\
s));
-          return false;
+          return ATTACH_FAIL;
         }
       } else {
-        print_debug("waitpid(): Child process exited/terminated (status
= 0x%x)\n", status);
-        return false;
+        print_debug("waitpid(): Child process %d exited/terminated
(status = 0x%x)\n", pid, status);
+        return ATTACH_THREAD_DEAD;
       }

8u:

         if (!ptrace_continue(pid, WSTOPSIG(status))) {
-          print_error("Failed to correctly attach to VM. VM might HANG!
[PTRACE_CONT failed, stopped by %d]\n", WSTOPSIG(statu\
s));
-          return false;
+          print_debug("waitpid(): Child process %d exited/terminated
(status = 0x%x)\n", pid, status);
+          return ATTACH_THREAD_DEAD;
         }
       } else {
         print_debug("waitpid(): Child process exited/terminated (status
= 0x%x)\n", status);

It looks like the ATTACH_FAIL change has been lost and the
ATTACH_THREAD_DEAD change moved to the block above. Was this deliberate?

Rest looks ok.

Thanks,
-- 
Andrew :)

Senior Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222
https://keybase.io/gnu_andrew



More information about the jdk8u-dev mailing list