My Oracle Support Banner

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

Last updated on DECEMBER 16, 2023

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.


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:IPADDRESS1:PORT1 ::ffff:IPADDRESS2:PORT SYN_SENT

lsof:
java PID oracle 440u IPv6 36032994 TCP mymachine:PORT1->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 PID oracle 440u sock 0,5 36032994 can't identify protocol      <---- this is the leak

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.