tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <>
Subject Re: CLOSE_WAIT connections when OutOfMemoryError is thrown
Date Tue, 04 Sep 2018 07:51:42 GMT
On 04/09/18 03:20, Antonio Rafael Rodrigues wrote:
> Hi
> In my rest API, everytime time my request generates an OutOfMemoryError the
> client doesn't get a response from server and hangs forever. If I kill the
> client, I can see by lsof that a CLOSE_WAIT connection remains and it goes
> away just if I restart the Spring application.
> I can reproduce it easily with an plain Servlet:
> public class CustomServlet extends HttpServlet {
>     @Override
>     protected void doGet(HttpServletRequest req, HttpServletResponse resp)
> throws ServletException, IOException {
>         System.out.println("Test");
>         throw new OutOfMemoryError();
>     }
> }
> Any request to this servlet hangs, if the client gives up  a CLOSE_WAIT
> connection remains.
> I'd like to know if there is some way to get over it

No. Once an OOME occurs the JVM is in a potentially unknown / unstable
state and the only safe thing to do is to shut it down and restart it.
There are some OOMEs that are potentially recoverable but reliably
determining if this is the case is tricky.

> and if it is a bug.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message