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

            Bug ID: 65317
           Summary: PerMessageDeflate getMoreData doesn't return correct
                    TransformationResult if the payload is inflated to
                    exact 8192 bytes
           Product: Tomcat 9
           Version: 9.0.31
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebSocket
          Assignee: dev@tomcat.apache.org
          Reporter: saksham.ve...@gmail.com
  Target Milestone: -----

Created attachment 37868
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37868&action=edit
A probable fix for the issue. Needs confirmation though.

If the compression is enabled and inflated size is exactly 8192, then tomcat
closes the websocket connection with Close code 1009 below message:

No async message support and buffer too small. Buffer size: [8,192], Message
size: [1,202]] 


Root cause:

PerMessageDeflate.getMoreData() finds that there's no space in the buffer but
doesn't check if at that time, the complete message is written or not. 

And thus, instead of returning the END_OF_FRAME it returns OVERFLOW.
It causes to close the connection with a message that doesn't make much sense
(buffer size 8192 is small for message size 1202).

With the attached file containing the changes, I was able to get around the
problem and my connection was stable, but not sure if this is the most elegant
way to do it as there's already some complicated logic to find the
TransformationResut.

-- 
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