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.
Then I try with the newer wildfly verion 12 or above it's doesn't happen
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
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?