Fwd: RFR: 8181085: Race condition in method resolution may produce spurious NullPointerException (original) (raw)
Andrew Dinn adinn at redhat.com
Thu May 25 13:16:40 UTC 2017
- Previous message: RFR: 8166651: OrderAccess::load_acquire &etc should have const parameters
- Next message: Fwd: RFR: 8181085: Race condition in method resolution may produce spurious NullPointerException
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Forwarding this to hotpsot-dev which is probably the more appropriate destination.
-------- Forwarded Message -------- Subject: RFR: 8181085: Race condition in method resolution may produce spurious NullPointerException Date: Thu, 25 May 2017 14:12:53 +0100 From: Andrew Dinn <adinn at redhat.com> To: jdk10-dev <jdk10-dev at openjdk.java.net>
The following webrev fixes a race condition that is present in jdk10 and also jdk9 and jdk8. It is caused by a misplaced volatile keyword that faild to ensure correct ordering of writes by the compiler. Reviews welcome.
http://cr.openjdk.java.net/~adinn/8181085/webrev.00/
Backporting: This same fix is required in jdk9 and jdk8.
Testing: The reproducer posted with the original issue manifests the NPE reliably on jdk8. It does not manifest on jdk9/10 but that is only thanks to changes introduced into the resolution process in jdk9 which change the timing of execution. However, without this fix the out-of-order write problem is still present in jdk9/10, as can be seen by eyeballing the compiled code for ConstantPoolCacheEntry::set_direct_or_vtable_call.
The patch has been validated on jdk8 by running the reproducer. It stops any resulting NPEs.
The code for ConstantPoolCacheEntry::set_direct_or_vtable_call on jdk8-10 has been eyeballed to ensure that post-patch the assignments now occur in the correct order.
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
- Previous message: RFR: 8166651: OrderAccess::load_acquire &etc should have const parameters
- Next message: Fwd: RFR: 8181085: Race condition in method resolution may produce spurious NullPointerException
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]