SocketException: demasiados archivos abiertos

I am running my application on jboss7.0.2. After some time VM started throwing error "FileNotFoundException : Too many open files". Immediately after this, the exception changed into "SocketException: Too many open files" and all the socket connection started getting rejected.

when i list out the files using ,

lsof -p (PID of java) 

java    2981 jboss  cwd    DIR    202,1       4096   286892 /opt/jboss7/bin
java    2981 jboss  mem    REG    202,1    3101294   303234 /opt/jboss7/modules/com/sun/xml/bind/main/jaxb-xjc-2.2.jar
java    2981 jboss  mem    REG    202,1     872839   303232 /opt/jboss7/modules/com/sun/xml/bind/main/jaxb-impl-2.2.jar
java    2981 jboss  mem    REG    202,1     543044   303191 /opt/jboss7/modules/org/joda/time/main/joda-time-1.6.2.jar
java    2981 jboss  mem    REG    202,1       7662   337202 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/slf4j-simple-1.6.4.jar-5e712b1d3aa271f5/slf4j-simple-1.6.4.jar
java    2981 jboss  mem    REG    202,1      20639   337199 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/log4j-over-slf4j-1.6.4.jar-da4eaca58ac78436/log4j-over-slf4j-1.6.4.jar
java    2981 jboss  mem    REG    202,1      31284   337194 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/jcommander-1.12.jar-c61b19af70c8bf25/jcommander-1.12.jar
java    2981 jboss  mem    REG    202,1     666665   337191 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/guice-2.0.jar-29aff9bdf30d9ec6/guice-2.0.jar
java    2981 jboss  mem    REG    202,1     121070   337188 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/junit-3.8.1.jar-e882fc70a94f89bb/junit-3.8.1.jar
java    2981 jboss  mem    REG    202,1     659413   337185 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/trove-1.1-beta-5.jar-71bab73f2a1e98c9/trove-1.1-beta-5.jar
java    2981 jboss  mem    REG    202,1     608376   337182 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/c3p0-0.9.1.jar-7d5529e5d213dc5/c3p0-0.9.1.jar
java    2981 jboss  mem    REG    202,1     539705   337179 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/postgresql-9.0-801.jdbc4.jar-984beb99091b7785/postgresql-9.0-801.jdbc4.jar
java    2981 jboss  mem    REG    202,1      26361   337176 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/asm-1.5.3.jar-54fb77fde523b0a9/asm-1.5.3.jar
java    2981 jboss  mem    REG    202,1    2309955   337173 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/hibernate-core-3.3.2.GA.jar-b8a8129c26f4cd51/hibernate-core-3.3.2.GA.jar
java    2981 jboss  mem    REG    202,1      15347   337170 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/opencsv-2.0.jar-888b8a58480bd822/opencsv-2.0.jar
java    2981 jboss  mem    REG    202,1     109318   337167 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/xml-apis-1.0.b2.jar-630532004dbb4129/xml-apis-1.0.b2.jar
java    2981 jboss  mem    REG    202,1      57779   337164 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/commons-fileupload-1.2.1.jar-5294101c9a62497a/commons-fileupload-1.2.1.jar
java    2981 jboss  mem    REG    202,1     282244   337161 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/cglib-2.1_2.jar-4ec9fd3801bb1495/cglib-2.1_2.jar
java    2981 jboss  mem    REG    202,1     644148   337158 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/javassist-3.12.1.GA.jar-5495cc51e7d87d08/javassist-3.12.1.GA.jar
java    2981 jboss  mem    REG    202,1     232121   337155 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/snakeyaml-1.6.jar-71fb94779beb43bc/snakeyaml-1.6.jar
java    2981 jboss  mem    REG    202,1      25962   337152 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/slf4j-api-1.6.4.jar-87ef6bbe594711ec/slf4j-api-1.6.4.jar
java    2981 jboss  mem    REG    202,1       4467   337149 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/aopalliance-1.0.jar-9912ab03a6271bc3/aopalliance-1.0.jar
java    2981 jboss  mem    REG    202,1     568435   337146 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/testng-5.14.9.jar-a15bf7544fe18e09/testng-5.14.9.jar
java    2981 jboss  mem    REG    202,1     443432   337143 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/antlr-2.7.6.jar-61bc20b99e33636b/antlr-2.7.6.jar
java    2981 jboss  mem    REG    202,1      87776   337140 /opt/jboss7/standalone/tmp/vfs/deployment89b34d33a7ecad72/commons-io-1.3.2.jar-512e37e2249c5643/commons-io-1.3.2.jar
java    2981 jboss  783u  IPv6 54509212       0t0      TCP Cloud.ecommunicate.celebritytalktone.mobi:webcache->Cloud.ecommunicate.celebritytalktone.mobi:36810 (CLOSE_WAIT)
java    2981 jboss  784u  IPv6 54509228       0t0      TCP Cloud.ecommunicate.celebritytalktone.mobi:webcache->Cloud.ecommunicate.celebritytalktone.mobi:36812 (CLOSE_WAIT)
java    2981 jboss  785u  IPv6 54509501       0t0      TCP Cloud.ecommunicate.celebritytalktone.mobi:webcache->Cloud.ecommunicate.celebritytalktone.mobi:36818 (CLOSE_WAIT)
java    2981 jboss  786u  IPv6 54509555       0t0      TCP Cloud.ecommunicate.celebritytalktone.mobi:webcache->Cloud.ecommunicate.celebritytalktone.mobi:36821 (CLOSE_WAIT)
java    2981 jboss  787u  IPv6 54509689       0t0      TCP Cloud.ecommunicate.celebritytalktone.mobi:webcache->Cloud.ecommunicate.celebritytalktone.mobi:36825 (CLOSE_WAIT)

preguntado el 31 de enero de 12 a las 08:01

3 Respuestas

You can use linux command ulimit to set the maximum number of opened file handles, to a larger value. For example:

ulimit -n 60000

Respondido el 31 de enero de 12 a las 12:01

El ulimit answer is correct.

However, you may first need to edit your /etc/security/limits.conf file to allow the user to increase these limits:

# to give all users a hard limit of 60000 open files
*         hard   nofile   60000
# to give user "jbossuser" a default limit of 60000 open files
jbossuser -      nofile   60000

Respondido 12 Jul 13, 22:07

It Exceeded the number of open file descripted limits. Solution : Increase the Hard and soft limits on number of open files.

  • soft nofile 999999
  • hard nofile 999999 In /etc/security/limits.conf file

respondido 13 mar '14, 11:03

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.