Classload of sun.nio.ch.Net fails - regression in jdk7u25
Martin Buchholz
martinrb at google.com
Fri Sep 20 17:22:39 UTC 2013
So, I did the experiment I suggested:
jar tf $jdk/jre/lib/rt.jar | sed -n 's/\.class$//p' | sed 's/\//./g' |
while read class; do j java LoadClass $class; done
and got 148 UnsatisfiedLinkErrors (a.k.a. "a rich crop of bugs")
Here are the ones Alan himself may want to fix:
Exception in thread "main" java.lang.UnsatisfiedLinkError:
java.net.SocketInputStream.init()V
at java.net.SocketInputStream.init(Native Method)
at java.net.SocketInputStream.<clinit>(SocketInputStream.java:47)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
java.net.SocketOutputStream.init()V
at java.net.SocketOutputStream.init(Native Method)
at java.net.SocketOutputStream.<clinit>(SocketOutputStream.java:46)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.EPoll.eventSize()I
at sun.nio.ch.EPoll.eventSize(Native Method)
at sun.nio.ch.EPoll.<clinit>(EPoll.java:53)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.EPollArrayWrapper.sizeofEPollEvent()I
at sun.nio.ch.EPollArrayWrapper.sizeofEPollEvent(Native Method)
at sun.nio.ch.EPollArrayWrapper.<clinit>(EPollArrayWrapper.java:67)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.FileKey.initIDs()V
at sun.nio.ch.FileKey.initIDs(Native Method)
at sun.nio.ch.FileKey.<clinit>(FileKey.java:73)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.KQueue.keventSize()I
at sun.nio.ch.KQueue.keventSize(Native Method)
at sun.nio.ch.KQueue.<clinit>(KQueue.java:50)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.Net.isExclusiveBindAvailable()I
at sun.nio.ch.Net.isExclusiveBindAvailable(Native Method)
at sun.nio.ch.Net.<clinit>(Net.java:58)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.SctpNet.init()V
at sun.nio.ch.SctpNet.init(Native Method)
at sun.nio.ch.SctpNet.<clinit>(SctpNet.java:368)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
Exception in thread "main" java.lang.UnsatisfiedLinkError:
sun.nio.ch.Net.isExclusiveBindAvailable()I
at sun.nio.ch.Net.isExclusiveBindAvailable(Native Method)
at sun.nio.ch.Net.<clinit>(Net.java:58)
at
sun.nio.ch.SocketOptionRegistry$LazyInitialization.options(SocketOptionRegistry.java:61)
at
sun.nio.ch.SocketOptionRegistry$LazyInitialization.<clinit>(SocketOptionRegistry.java:57)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at LoadClass.main(LoadClass.java:4)
On Thu, Sep 19, 2013 at 6:21 PM, Martin Buchholz <martinrb at google.com>wrote:
>
>
>
> On Thu, Sep 19, 2013 at 5:30 PM, Alan Bateman <Alan.Bateman at oracle.com>wrote:
>
>> Martin,
>>
>> I'm curious how you ran into this.
>
>
> I'm not aware of any way to trigger this using just public APIs.
> We sometimes fiddle with the internals of the JDK networking
> implementation.
> So it's possible that no one will run into this in a "strictly conforming"
> java program.
>
>
>> I agree this should be fixed, it's just not immediately obviously which
>> APIs would cause Net to be loaded before other classes that would cause the
>> native library to be loaded. I'm not aware of any bug reports so I'm
>> curious if you have the original stack trace (not from the Class.forName).
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20130920/dfca6a85/attachment.html
More information about the nio-dev
mailing list