JDK-4476687 : java.net.SocketException: Too many open files
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 1.4.0
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_7
  • CPU: generic
  • Submitted: 2001-06-29
  • Updated: 2001-07-27
  • Resolved: 2001-07-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
1.4.0 beta2Fixed
Description
I'm running the test for bug 4474991 (please see that bug for instructions on
how to run the tests) and I'm seeing this failure with build 70.  This is
from the client part of the test.  In the same shell (same environment) this
tests runs past this point with build 69.

starting client...
created 40 clients
Client: java.net.SocketException: Too many open files
        at java.net.Socket.createImpl(Socket.java:307)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Method.java:311)
        at sun.nio.ch.Reflect.invokeIO(Reflect.java:93)
        at sun.nio.ch.Net.createImpl(Net.java:111)
        at sun.nio.ch.ChannelSocket.create(ChannelSocket.java:49)
        at sun.nio.ch.SocketChannelImpl.<init>(SocketChannelImpl.java:53)
        at sun.nio.ch.SelectorProviderImpl.openSocketChannel(SelectorProviderImpl.java:41)
        at java.nio.channels.SocketChannel.open(SocketChannel.java:113)
        at RemoteEntity.reset(SelectorTest.java:227)
        at RemoteEntity.connect(SelectorTest.java:237)
        at RemoteEntity.cycle(SelectorTest.java:256)
        at SelectorTest$Client.go(SelectorTest.java:106)
        at TestThread.run(TestThread.java:27)
Exception in thread "main" java.lang.Exception: Failure
        at SelectorTest.main(SelectorTest.java:76)

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: generic merlin-beta2 FIXED IN: merlin-beta2 INTEGRATED IN: merlin-beta2
14-06-2004

PUBLIC COMMENTS This is an exception that did not occur with the previous build.
10-06-2004

EVALUATION "Too many files" indicates that we are running out of file descriptors. On examination it appears that sun.nio.ch.ChannelSocket is closing the channel but not the underlying socket, viz :- at java.nio.channels.spi.AbstractChannel.close(AbstractChannel.java:95) => open is 'false' at sun.nio.ch.ChannelSocket.close(ChannelSocket.java:173) at sun.nio.ch.SocketChannelImpl.implCloseSelectableChannel(SocketChannelImpl.java:297) at java.nio.channels.spi.AbstractSelectableChannel.implCloseChannel(AbstractSelectableChannel.java:187) at java.nio.channels.spi.AbstractChannel.close(AbstractChannel.java:100) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:217) at RemoteEntity.connect(SelectorTest.java:236) at RemoteEntity.cycle(SelectorTest.java:259) at SelectorTest$Client.go(SelectorTest.java:106) at TestThread.run(TestThread.java:27) Re-assigning to classes_nio as it seems that sun.nio.ch.ChannelSocket should be using closeSocket to close the socket. alan.bateman@ireland 2001-07-09
09-07-2001