JDK-5045306 : Http keep-alive implementation is not efficient
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.4.1,5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_xp
  • CPU: generic,x86
  • Submitted: 2004-05-11
  • Updated: 2005-09-16
  • Resolved: 2005-09-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6 betaFixed
Related Reports
Duplicate :  
Current http keep-alive implementation requires user code to clean up pending data before it can be reused. it is too much burden on programmers.

Also see #5039967

###@###.### 2004-05-11

Cut & paste from email discussions about the root cause for 5039967:

Zhengyu Gu wrote: 

"When plugin download jars, it wraps input stream with JarInputStream, even plugin iterators all jar etnries and reads all entry content, it seems that input stream is still not clean. The solution is to empty the input stream  if iterating jar entries.

I realized that your fix was not enough for plugin, I was hoping that networking code could provide simple call to cleanup the channel. For example, if user code call InputStream.close() && keep-alive is on, then close() call should put into pool, and when the connection is retrieved from the pool, cleanup code will be executed to clean up the pending data and connection become resuable."

EVALUATION Implemented an async cleanup of unread data from the underlying socket. This is configurable through the network properties http.KeepAlive.remainingData and http.KeepAlive.queuedConnections in net.properties.

EVALUATION yingxian wang wrote: "So this bug is really different from the one that Neal @ NSA reported. InputStream.close() will only try to reuse the connection if all response body has arrived. Otherwise, we wouldn't try to reuse the connection. This is definitely something that we can look into to improve in a future release." Not clear whether this is a plugin or java.net bug. Check 4814794 Will try to fix in mustang ###@###.### 2005-06-15 15:44:56 GMT