Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liberty Closes the Persistent Connection in error state #30757

Open
seshadhri-aswath opened this issue Feb 11, 2025 · 0 comments · May be fixed by #30732
Open

Liberty Closes the Persistent Connection in error state #30757

seshadhri-aswath opened this issue Feb 11, 2025 · 0 comments · May be fixed by #30732
Assignees
Labels
in:Transport release bug This bug is present in a released version of Open Liberty team:Sirius

Comments

@seshadhri-aswath
Copy link
Contributor

seshadhri-aswath commented Feb 11, 2025

Describe the bug
Liberty closes persistent (Keep-Alive) connections if an error occurs with the IO stream when the response is already committed.

[1/15/25, 0:02:59:032 PST] 00000036 HttpDispatche 3 Error closing stream; java.io.IOException: Invalid state [1/15/25, 0:02:59:032 PST] 00000036 HttpDispatche < closeStreams Exit java.io.IOException: Invalid state at com.ibm.ws.http.channel.internal.outbound.HttpOutputStreamImpl.flushBuffers(HttpOutputStreamImpl.java:554)

This causes issues when the request is routed through IBM HTTP Server (IHS) plugin, resulting in 500 Internal Server Error. This also causes issues from a client side with the socket closing from the server when the client would expect it to be open to continue reading and writing to it. It depends on the client implementation the specific type of issue that could be seen.

Steps to Reproduce
There are a few ways this error can occur. Here is one example:

  1. Hit as JSP that calls HttpServletResponse#sendRedirect (scriptlet code) to another page.
  2. The same JSP then writes out more data (via jsp:include, for instance)
  3. Webcontainer is handling the redirect, but the response is committed (caused by the additional data written) which leads to an invalid state.
  4. The socket connection is closed by the channel / transport.

Expected behavior
The stream should remain open. This was be behavior in Traditional WebSphere, but was changed in Liberty. A new property will be introduced to restore the older Traditional WebSphere behavior if opted in.

Diagnostic information:

  • OpenLiberty Version: ALL
  • Affected feature(s) Any features which rely on servlet. (i.e servlet-3.1, servlet-4.0, etc)
  • Java Version: N/A
  • server.xml configuration N/A

Additional context

The 500 error response occurs when IHS is used. Users may also experience a java.net.SocketException: Connection reset and other SocketExceptions depending on the client implementation used for driving the request.

New HTTP Option:

<httpEndpoint host="*" httpPort="9080" httpsPort="9443" id="HTTPS">
   <httpOptions persistOnError="true"/>
</httpEndpoint>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:Transport release bug This bug is present in a released version of Open Liberty team:Sirius
Projects
Status: General Issues
Development

Successfully merging a pull request may close this issue.

4 participants