Java: Exception in light weight http server code

Bug #995000 reported by Alex Bligh
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openjdk-6 (Ubuntu)
New
Undecided
Unassigned

Bug Description

The sun.net.httpserver randomly fails with java.lang.ArrayIndexOutOfBoundsException: 4104 at sun.net.httpserver.ChunkedOutputStream.writeChunk(ChunkedOutputStream.java:120) - full stack trace below.

In essence a combination of writes to the class can end up leaving the ChunkedOutputStream with exactly CHUNK_SIZE bytes in, and a further write will under various circumstances overfill the buffer. This will then cause an exception with the chunk is written.

This bug is documented at Sun/Oracle with bug number #6744329:
  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6744329

The patch to fix it is here:
  http://hg.openjdk.java.net/jdk7/jsn/jdk/rev/b0378bb50d83

The bug at Sun marks this fixed as follows:
  Release Fixed 7(b37), 6u18(b03) (Bug ID:2183328)

However, despite the 6u18(b03) tag above, the Ubuntu source the current Lucide openjdk build (openjdk-6_6b20-1.9.13-0ubuntu1~10.04.1) does not contain the relevant patch. My reading of the the relevant Java version numbers (which might not be correct) is that it should contain this patch (18<20), so it appears to have dropped somewhere.

As the effects are serious (random failure of http server), and the patch is upstream, has been around since Sep 2008, and is obviously correct, I am asking for an SRU.

I have verified this problem on Lucid. I have not verified on Maverick, Natty, or Oneiric, but I expect it is the same. I have not verified it on Precise, though I think that might have openjdk 7 on.

Full stack trace:

May 3 16:01:19 extility-qav-2kvm jade: java.lang.ArrayIndexOutOfBoundsException: 4104
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.ChunkedOutputStream.writeChunk(ChunkedOutputStream.java:120)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.ChunkedOutputStream.flush(ChunkedOutputStream.java:156)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.ChunkedOutputStream.close(ChunkedOutputStream.java:131)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.PlaceholderOutputStream.close(ExchangeImpl.java:421)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.ExchangeImpl.close(ExchangeImpl.java:141)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.HttpExchangeImpl.close(HttpExchangeImpl.java:67)
May 3 16:01:19 extility-qav-2kvm jade: at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handleExchange(WSHttpHandler.java:100)
May 3 16:01:19 extility-qav-2kvm jade: at com.sun.xml.internal.ws.transport.http.server.WSHttpHandler.handle(WSHttpHandler.java:80)
May 3 16:01:19 extility-qav-2kvm jade: at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:83)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:72)
May 3 16:01:19 extility-qav-2kvm jade: at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:86)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:589)
May 3 16:01:19 extility-qav-2kvm jade: at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:83)
May 3 16:01:19 extility-qav-2kvm jade: at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:561)
May 3 16:01:19 extility-qav-2kvm jade: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
May 3 16:01:19 extility-qav-2kvm jade: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
May 3 16:01:19 extility-qav-2kvm jade: at java.lang.Thread.run(Thread.java:636)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.