Bug 61660

Summary: Calling flush() on servlet response print writer while compression is enabled produces corrupted response
Product: Tomcat 7 Reporter: Ayman Madkour <ayman.madkour>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED INVALID    
Severity: major CC: maarten
Priority: P2    
Version: 7.0.82   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: A sample servlet code to reproduce the issue

Description Ayman Madkour 2017-10-24 13:04:48 UTC
Created attachment 35453 [details]
A sample servlet code to reproduce the issue

The issue happens only on Oracle JDK 8 update 151/152, not before.

Calling flush() on servlet response print writer while compression is enabled produces corrupted response.

See attached servlet.
Comment 1 Remy Maucherat 2017-10-24 13:14:23 UTC
As a side note, without looking at the merits of the BZ, I'd like to point out that the very common habit of doing flush and/or close at the end of a servlet is a bad idea, it may impair better error processing and will always degrade performance.
Comment 2 Mark Thomas 2017-10-24 19:57:48 UTC
This is a know issue with the JRE and will fixed in the next JRE release.

https://bugs.openjdk.java.net/browse/JDK-8189788
Comment 3 Mark Thomas 2017-12-06 17:01:24 UTC
*** Bug 61866 has been marked as a duplicate of this bug. ***