<AWT Dev> Review Request For 8146230: Crash in JNI_ArgumentPusherVaArg::JNI_ArgumentPusherVaArg(_jmethodID*, __va_list_tag*)+0xa

Ambarish Rapte ambarish.rapte at oracle.com
Wed Jul 6 11:23:47 UTC 2016


Hi,

 

                Please review the fix for JDK9,

                Bug: https://bugs.openjdk.java.net/browse/JDK-8146230

                Webrev: http://cr.openjdk.java.net/~arapte/8146230/webrev.00/

 

 

Issue:

1.       Null pointer exception in JNI

 

Cause:

The code block was not multi thread safe.

Issue occurs in  multi threaded , multi processor environment.

 

Fix:

1.       Changed the variable used for double checking, to use  yieldMethodID .

2.       Changed yieldMethodID  to  volatile.

3.       Added AWT_LOCK() over initialize block of code.

4.       Removed unrequired  err variable.

 

A drawback of Double Check Locking ( DCL ) is, if the resource assignment is not an atomic operation, The DCL may fail.

But here in the code of concern, is an atomic operation. Hence DCL should work fine.

Please check below reference link for more detailed discussion of DCL with C++.

 

 

Verification:

1.       Tested Event tests which pass without any regression of this change.

2.       As this change only corrects existing logic, there should be no side effects.

 

 

Reference:

                C++ and the Perils of Double-Checked Locking:  http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf

 

 

Regards,

Ambarish

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20160706/808109d6/attachment-0001.html>


More information about the awt-dev mailing list