On Fri, 19 Feb 2021 21:44:15 GMT, Weijun Wang <[email protected]> wrote:
> `InetAddress` is loading native library `net` and at the same time
> `SunNativeProvider` is loading `j2gss`, and in the `OnLoad` function inside
> `j2gss` it is calling `FindClass(env, "java/net/InetAddress")` and thus a
> deadlock.
>
> We can access `InetAddress` in `SunNativeProvider.<clinit>` before loading
> the jgss library. i.e. use `Class.forName` to ensure `InetAddress` is
> initialized. Thanks to @dholmes-ora for providing this workaround.
>
> No new regression test, hard to reproduce.
src/java.security.jgss/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
line 74:
> 72:
> System.getProperty("sun.security.nativegss.debug"));
> 73: try {
> 74: Class.forName("java.net.InetAddress");
The returned value of Class.forName() is not used, someone else could delete
this line later is he/she does not know the story behind this line. Would you
mind add a few line comments about why it is added?
Otherwise, looks good to me.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2655