1 Reply Latest reply: Oct 13, 2011 3:30 PM by Vítor Corrêa RSS

    java.net.SocketException: Too many open files

    spallai Newbie

      My application needs a restart, when encountered with  "Too many open files", because most of the functionality was failing. The console logs is full of below stacktrace. Environment used id java1.6 & JBoss [Zion] 4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231054).

       

      ERROR [MainDeployer] Could not initialise deployment: file:/export/home/jboss/server/deploy/jboss-aop.deployer/

      org.jboss.deployment.DeploymentException: /export/home/jboss/server/deploy/jboss-aop.deployer/META-INF/jboss-service.xml (Too many open files); - nested throwable: (java.io.FileNotFoundException:/export/home/jboss/server/deploy/jboss-aop.deployer/META-INF/jboss-service.xml (Too many open files))

      at org.jboss.deployment.SARDeployer.init(SARDeployer.java:200)

      at org.jboss.deployment.MainDeployer.init(MainDeployer.java:843)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:780)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)

      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)

      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)

      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)

      at $Proxy9.deploy(Unknown Source)

      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)

      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182)

      Caused by: java.io.FileNotFoundException: /export/home/jboss/server/deploy/jboss-aop.deployer/META-INF/jboss-service.xml (Too many open files)

      at java.io.FileInputStream.open(Native Method)

      at java.io.FileInputStream.<init>(Unknown Source)

      at org.jboss.net.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:93)

      at java.net.URL.openStream(Unknown Source)

      at org.jboss.deployment.SARDeployer.parseDocument(SARDeployer.java:582)

      at org.jboss.deployment.SARDeployer.init(SARDeployer.java:164)

      ... 21 more

      10:51:59,503 ERROR [MainDeployer] Could not initialise deployment: file:/export/home/jboss/server/deploy/jboss-bean.deployer/

      org.jboss.deployment.DeploymentException: /export/home/jboss/server/deploy/jboss-bean.deployer/META-INF/jboss-service.xml (Too many open files); - nested throwable: (java.io.FileNotFoundException: /export/home/jboss/server/deploy/jboss-bean.deployer/META-INF/jboss-service.xml (Too many open files))

      10:51:58,601 ERROR [MainDeployer] Could not make local copy for file:/export/home/jboss/server/deploy/ormGsxUpgradeIntf.jar

      java.io.FileNotFoundException: /export/home/jboss/server/tmp/deploy/tmp1896466099165637966ormGsxUpgradeIntf.jar (Too many open files)

      at java.io.FileOutputStream.open(Native Method)

      at java.io.FileOutputStream.<init>(Unknown Source)

      at java.io.FileOutputStream.<init>(Unknown Source)

      at org.jboss.deployment.MainDeployer.copy(MainDeployer.java:1206)

      at org.jboss.deployment.MainDeployer.makeLocalCopy(MainDeployer.java:1151)

      at org.jboss.deployment.MainDeployer.init(MainDeployer.java:822)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:780)

      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:753)

      at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

      at java.lang.reflect.Method.invoke(Unknown Source)

      at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)

      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)

      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)

      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)

      at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)

      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)

      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)

      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:176)

      at $Proxy9.deploy(Unknown Source)

      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:319)

      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:507)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:192)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:203)

      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:182)

      10:51:58,604 WARN  [JARDeployer] Failed to add deployable jar:

       

       

      One set of console error forseen is as below

       

      10:52:14,881 ERROR [NamingService] Naming accept handler stopping

      java.net.SocketException: Too many open files

      at java.net.PlainSocketImpl.socketAccept(Native Method)

      at java.net.PlainSocketImpl.accept(Unknown Source)

      at java.net.ServerSocket.implAccept(Unknown Source)

      at java.net.ServerSocket.accept(Unknown Source)

      at org.jnp.server.Main$AcceptHandler.run(Main.java:417)

      at org.jboss.util.threadpool.RunnableTaskWrapper.run(RunnableTaskWrapper.java:134)

      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)

      at java.lang.Thread.run(Unknown Source)

      Jul 6, 2011 10:52:14 AM sun.rmi.transport.tcp.TCPTransport$AcceptLoop executeAcceptLoop

      WARNING: RMI TCP Accept-1098: accept loop for ServerSocket[addr=/0.0.0.0,port=0,localport=1098] throws

      java.net.SocketException: Too many open files

      at java.net.PlainSocketImpl.socketAccept(Native Method)

      at java.net.PlainSocketImpl.accept(Unknown Source)

      at java.net.ServerSocket.implAccept(Unknown Source)

      at java.net.ServerSocket.accept(Unknown Source)

      at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.executeAcceptLoop(Unknown Source)

      at sun.rmi.transport.tcp.TCPTransport$AcceptLoop.run(Unknown Source)

      at java.lang.Thread.run(Unknown Source)

       

      Folks, any idea what would be causing this, or any patch that has the fix available

        • 1. Re: java.net.SocketException: Too many open files
          Vítor Corrêa Newbie

          Hi,

           

          It happens when the OS can't handlle with many files. Each socket has it owns descriptor, and JBoss has other descriptor files.

          I use fedora so with >> ulimit -n << i can see how many files my user is allowed to open. You can increase it with >> ulimit -n 4096 <<

           

          *Remember this is how many files descriptors your user session can open.

           

          You also should check /proc/sys/fs/file-max you can check how many file descriptors your OS can handle ( you can increase that too )

           

          on /etc/security/limits.conf you can set the start descriptors for your use. Its the definitly configuration.

           

          Make those changes and try a restart.

           

          Good Lucky