Socket/FileDescriptor Leak When Executing WLS Application To A Blocked Port Using Weglogic HTTPClient Package
Last updated on MARCH 06, 2017
Applies to:Oracle WebLogic Server - Version 126.96.36.199.0 and later
Information in this document applies to any platform.
On WebLogic Server 188.8.131.52.0 version, you observe file descriptor leak when using HttpURLConnection. This is when a client program running in WebLogic space tries to submit an URL to a remote server.
In the scenario issue can be reproduced to cause a file descriptor leak on linux - when method weblogic.net.http.HttpURLConnection.connect() throws exception because of a network problem that make the remote server unreachable, specifically when not able to complete most basic tcp/ip handshake sequence with the next network device which is supposed to handle the connection.
Issue reproduced if you try to connect to a remote server that is blocked by a firewall. Firewall drops initial SYN packet received from the client. This makes the connection hang in SYN_SENT state for a while, the socked is eventually cleaned up (not reported in netstat anymore), but the original file descriptor associated to the socket gets stuck forever associated to the process or jvm.
After 2 seconds (CONNECT_TIMEOUT) of waiting for connection you will notice the following exception:
In order to identify the presence of file descriptor leaks, monitor the WebLogic process using netstat and lsof.
cp 0 1 ::ffff:10.x.x.x:54522 ::ffff:10.yy.yy.yy:9999 SYN_SENT
java 32055 oracle 440u IPv6 36032994 TCP mymachine:54522->mymachine.abc.com:distinct (SYN_SENT)
* notice the 440u file descriptor in previous line
After a some minutes the socket is not listed (SYN_SENT) anymore, but querying the file descriptor(FD) 440 it remains there forever until the process is stopped.
Lsof (after several minutes or hours):
java 32055 oracle 440u sock 0,5 36032994 can't identify protocol <---- this is the leak
Sign In with your My Oracle Support account
Don't have a My Oracle Support account? Click to get started
My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms