Duplicate :
|
FULL PRODUCT VERSION : java version " 1.7.0_25 " Java(TM) SE Runtime Environment (build 1.7.0_25-b15) Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode) ADDITIONAL OS VERSION INFORMATION : Darwin local 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64 MAC OS X 10.8.4 A DESCRIPTION OF THE PROBLEM : We have trouble in developing a large web-application on Mac OS X after switching from Java 1.6 to Java 1.7. When the application is running in tomcat it is not possible to open new Socket connections. We are 8 developers having the same problem. All attempts to solve this problem by adjusting Mac OS X system preferences for open files etc have no effect. The problem only occurs on Mac OS X, not on Linux with the same jdk version. We found a way to reproduce this behavior in a little script. ERROR MESSAGES/STACK TRACES THAT OCCUR : Exception in thread " main " java.net.SocketException: Invalid argument at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) at java.net.ServerSocket.implAccept(ServerSocket.java:530) at java.net.ServerSocket.accept(ServerSocket.java:498) at SelectTest.main(SelectTest.java:16) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- import java.io.*; import java.net.*; public class SelectTest { public static void main(String[] args) throws Exception { // Use 1024 file descriptors. There'll already be some in use, obviously, but this guarantees the problem will occur for(int i = 0; i < 1024; i++) { new FileInputStream( " /dev/null " ); } ServerSocket socket = new ServerSocket(8080); socket.accept(); } } ---------- END SOURCE ----------