Socket/FileDescriptor Leak When Executing WLS Application To A Blocked Port Using Weglogic HTTPClient Package (Doc ID 2238406.1)

Last updated on MARCH 06, 2017

Applies to:

Oracle WebLogic Server - Version 12.2.1.1.0 and later
Information in this document applies to any platform.

Symptoms

On WebLogic Server 12.2.1.1.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.


ERROR
-----------------------
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.

netstat:
cp 0 1 ::ffff:10.x.x.x:54522 ::ffff:10.yy.yy.yy:9999 SYN_SENT

lsof:
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

Cause

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