| Summary: | response.getOutputStream().write() hangs forever if client doesn't consume the response | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] Jetty | Reporter: | Benjamin Jaton <benjamin.jaton> | ||||||||||
| Component: | server | Assignee: | Greg Wilkins <gregw> | ||||||||||
| Status: | RESOLVED INVALID | QA Contact: | |||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | gregw, jetty-inbox, joakim.erdfelt, laeubi | ||||||||||
| Version: | 8.1.16 | ||||||||||||
| Target Milestone: | 9.2.x | ||||||||||||
| Hardware: | All | ||||||||||||
| OS: | All | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
|
Description
Benjamin Jaton
Created attachment 249071 [details]
Client class
Created attachment 249073 [details]
Reproducible TestCase
Can you check with LSOF if there are any "hang" sockets shown? $ lsof -i | grep 15043 java 15043 benji 25u IPv6 512348321 0t0 TCP *:http-alt (LISTEN) Hope that helps! Created attachment 251437 [details]
jetty-9 version of testcase
Jetty 8 is EOL, no further updates to Jetty 8 will be done. Testcase attached by Benjamin does not run/execute as-is. If we fix the testcase, and upgrade it to Jetty 9, we can show that the behavior is as expected per the servlet spec. there are 4 possible scenarios. 1) Servlet -> OutputStream -> Client Reads 2) Servlet -> OutputStream -> Client Does Not Read 3) Servlet -> Writer -> Client Reads 4) Servlet -> Writer -> Client Does Not Read If the Client does not read the response data, then a Timeout occurs and the connection is closed. If the Servlet uses OutputStream, then the timeout is detected as a IOException If the Servlet uses PrintWriter, then the write operation completes immediately, and is handled by the servlet container. No exception is thrown. The timeout is eventually caught by the internal mechanisms of Jetty and the connection is closed. If the client reads the response data, then the connection is terminated normally (following http/1.1 persistent connection rules) Closing as INVALID |