RFR: 8260366: ExtendedSocketOptions <clinit> can deadlock in some circumstances [v2]

Jaikiran Pai jpai at openjdk.java.net
Thu Feb 18 10:44:03 UTC 2021


On Thu, 18 Feb 2021 09:57:19 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

>> Let me be more clear: I think that it's enough to have only 2 `volatile` field reads _in worst case_. We can use local variable to avoid more than needed reads.
>> Current code can perform read 4 times _in worst case_: twice outside `synchronized` block and twice inside `synchronized` block.
>> 
>> There are many examples of similar code in the JDK:
>> https://github.com/openjdk/jdk/blob/master/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Util.java#L48
>> https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/lang/StackFrameInfo.java#L125
>
> Ah! of course, I now see what you mean. I misunderstood your previous comment. I'll update this PR shortly.

I've now updated this PR which this suggested change.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2601


More information about the net-dev mailing list