aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes HttpUrlConnection leaves connections in CLOSED_WAIT state Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "HttpUrlConnection leaves connections in CLOSED_WAIT state" Watch "HttpUrlConnection leaves connections in CLOSED_WAIT state" New topic
Author

HttpUrlConnection leaves connections in CLOSED_WAIT state

Gary Hirschhorn
Greenhorn

Joined: Jun 22, 2004
Posts: 2
Our java application fetches pages from various websites. One of our customers is finding that their machines have a very large number of TCP/IP connections in CLOSED_WAIT states that are remaining for long periods of time. We have not been able to reproduce this -- any thoughts?

I have attached our basic processing code (with non-relevant code removed). We are running on Microsoft Windows Server 2003 and using Java 6 and the java.net.HttpURLConnection class. For each connection, we close the input stream after reading it, but do not disconnect, so that Java can re-use the connection. This normally produces many connections with TIMED_WAIT states, but only an occasional short-lived CLOSED_WAIT state.



Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 819

There is a bug report
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6215050

related to this. It seems to exactly match what you describe.

can you find out what version of java that particular customer is using?
Gary Hirschhorn
Greenhorn

Joined: Jun 22, 2004
Posts: 2
Thanks for the reply. I saw that bug report, but we are using Windows, Java 6 update 3. It seems the bug only applies to Linux and there are only complaints for Java 5 and earlier.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HttpUrlConnection leaves connections in CLOSED_WAIT state
 
Similar Threads
Strange prob with communication between co-located web apps - SocketTimeoutException: Read timed out
Chinese / English encoding problem
HttpURLConnection woes!
Fake a post request from java class
Socket Server only processing one request, then it just queues them up