You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2017/04/11 12:52:24 UTC

[Bug 60970] New: Endless loop in Http2UpgradeHandler#writeHeaders

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.wellekoetter@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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 60970] Endless loop in Http2UpgradeHandler#writeHeaders

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60970

Christian Wellekötter <c....@laudert.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |c.wellekoetter@laudert.de

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


[Bug 60970] Endless loop in Http2UpgradeHandler#writeHeaders

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60970

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Thanks for the report. That is where things are going wrong but there are
additional cases the proposed patch doesn't cover so it has been fixed with an
alternative patch.

Fixed in:
- trunk for 9.0.0.M20 onwards
- 8.5.x for 8.5.14 onwards

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


[Bug 60970] Endless loop in Http2UpgradeHandler#writeHeaders

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60970

Christian Wellekötter <c....@laudert.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

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