1

I have a small test with hello world application in JavaEE. I used wildfly 10 for deploy that app and use postman to execute api hello world. And then I use lsof command for check list open file of wildfly I saw the number increase in every request see the following picture. enter image description here Then I try with the newer wildfly verion 12 or above it's doesn't happen enter image description here

my api code enter image description here

I think this bug is fixed in newer version, but is there any work around to fix this problem in wildfly 10 or 11. Currently I cannot upgrade to new version for some reason.

I use docker in window for testing this and two images openshift/wildfly-100-centos7, openshift/wildfly-120-centos7

== Updated information after investigation deeply

I found one problem of my application that lead to a situation too many open file.

In our application server wildfly contain around 15war files and I use Client client = ClientBuilder.newClient(); for making rest api client between each module but after that I dont close this client properly then it will then be lead to too many open file.

With a small number of war file it's hard to lead to the problem but with a big number of war file it's easy to get that problem.

I use this command for find wildfly pid ps aux | grep wildfly then I use the following command that show me the number file open in wildfly sudo watch 'ls /proc/12750/fd | wc -l' 12750 is the pid of wildfly.

Then I check the maximum of file open in wildfly with command sudo cat /proc/12750/limits is 4096 enter image description here

I think I have two solution for it one is I have to close httpclient properly to make sure the number open file does not increase.

And other I have to increase that number 4096 to bigger because after my wildfly server startup the number is around 3700 already.

Then I found this command to increase the maximum prlimit --nofile=8192:8192 --pid 12750 but I got another problem when the number open file reach the old number is 4096 the exception say Caused by: java.net.SocketException: Connection reset or connection closed

aused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:210)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:160)
    at org.apache.http.impl.io.SocketInputBuffer.fillBuffer(SocketInputBuffer.java:84)
    at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:273)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:140)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:261)
    at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283)
    at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251)
    at org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:197)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:272)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:124)
    at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:685)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:487)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:882)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
    at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:283

Any has experience about it please help me?

mai danh
  • 853
  • 8
  • 14
  • [Looks like it's not a bug](https://developer.jboss.org/thread/276227) (although probably a poor feature if it could be improved in Wildfly12). Have you ran into problems because of this high number of file descriptors? – Aaron May 06 '19 at 12:21
  • My current wildfly contain about 13 war files, and one or two request the number increase to 3000000 and up to 5000000 after a few hours. Then i get too many file open when execute http client request inside services. [org.apache.http.impl.execchain.RetryExec] (default task-118) I/O exception (java.net.SocketException) caught when processing request to {}->http://localhost:8080: Too many open files – mai danh May 07 '19 at 01:43
  • One more information that wildfly 10 open duplication file, for example this file /wildfly/modules/system/layers/base/org/yaml/snakeyaml/main/snakeyaml-1.15.jar is repeated 88 times after restart server. https://drive.google.com/file/d/1lW391eC7Xu-DsgGrcvEcKkB0td8MX2vf/view?usp=sharing After 2 request I saw that the file above also repeated again around 6 times – mai danh May 15 '19 at 04:44
  • my wildfly 10 has around 40 war application. – mai danh May 16 '19 at 02:02
  • Hey @maidanh, I'm probably the only one reading your comments now and I've got no clue how to solve your problem other than updating to Wildfly 12. You might want to edit your question to include the information you've added as comments, that would put it back on the new questions queue where it could gain some attention. You might also have more luck on [the Wildfly forums](https://developer.jboss.org/en/wildfly) – Aaron May 16 '19 at 09:58

0 Answers0