Code Review 6921111: NullPointerException in PlainDatagramSocketImpl.socketSetOption
Alan Bateman
Alan.Bateman at Sun.COM
Fri Mar 26 06:45:05 PDT 2010
Christopher Hegarty - Sun Microsystems Ireland wrote:
> Hi Michael, Alan,
>
> This is a very small change to fix a problem in native code where, if
> multiple threads are executing the native method, an unset value of a
> static variable may be used. When setting static variables in a block
> we can only be sure they are all set when the last one is. This is a
> common pattern in the socket impl native code.
>
> I plan to clean up this area of native code and remove unnecessary
> duplicate static state, but for now I just want to resolve this
> specific bug.
>
> Webrev:
> http://cr.openjdk.java.net/~chegar/6921111/webrev.00/webrev/
>
> Thanks,
> -Chris.
The proposed change will help but I assume it is not bullet proof. A
slightly better fix might to be do the initialization if nis_addrsID or
ia_addressID is NULL. I know I've mentioned this to you before, but I
think it would be a lot better to just replace this code with a cleaner
implementation in java.
-Alan.
More information about the net-dev
mailing list