https://bz.apache.org/bugzilla/show_bug.cgi?id=60970

            Bug ID: 60970
           Summary: Endless loop in Http2UpgradeHandler#writeHeaders
           Product: Tomcat 8
           Version: 8.5.13
          Hardware: Macintosh
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: c.wellekoet...@laudert.de
  Target Milestone: ----

Created attachment 34905
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34905&action=edit
A proposal for a fix for the problem.

The method Http2UpgradeHandler#writeHeaders runs into an endless loop, if the
mime headers to send are too long.

Given following situation: In our web app we add additional states as cookies
into our request. This is causing a header amount greater than 1024 bytes. In
that case the named method needs to run line 540 (state =
getHpackEncoder().encode(coyoteResponse.getMimeHeaders(), target);) at least
twice.

On the first run, the used ByteBuffer will be filled with some data. After that
the data are written to the socket output.
Now the ByteBuffer claims to have zero bytes left to write, because its
position is set to its limit.
This causes the next call on line 540 to actually do nothing and writing the
same data again. And so the loop continues forever until an exception is
thrown.

To fix this problem, the ByteBuffer needs to be reset properly before writing
new data to it.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to