On Sun, 21 Apr 2024 19:03:53 GMT, robert engels <[email protected]> wrote:

>> fix bug JDK-B6968351 by avoiding flush after response headers
>
> robert engels has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   flush after exchange returns

src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java line 851:

> 849:                     uc.doFilter (new HttpExchangeImpl (tx));
> 850:                 }
> 851:                 tx.getResponseBody().flush();

I admire the creativity, but I don't think we can do that here. At this point 
the stream can be owned by another thread, either because the response was 
completed and we are now handling another request, or because the user decided 
to handle the request on a separate thread started from `handle`. In either 
case, flushing here could lead to concurrency issues like sending the wrong 
data to the user.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18667#discussion_r1574656121

Reply via email to