tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frits>
Subject AsyncContext to closed connection reports no error??
Date Tue, 21 May 2019 08:29:54 GMT
Dear list,

I have a problem with the asynchronous servlet support in Tomcat (on both
9.0.16 and 9.0.20). The issue is as follows.
I have implemented a Servlet which will receive connections from a client
program. The servlet will accept this connection and immediately calls
request.startAsync(request, resp) with it, queues the resulting
AsyncContext and returns.

The idea now is that if the servlet has something to tell that client it
will find the queued AsyncRequest and send a command back to the client
with it using the normal getResponse().getWriter() and complete() calls on
the context. This works like a charm.
However, if I terminate the client program while it has a request pending
the servlet never gets any indication that the client has left. What's even
worse: using the AsyncContext and sending a response works without errors
too - no exceptions are thrown, and the listener added to the
AsyncConnection just reports that everything went fine. No error callback,
onComplete called without any exception in the event.

All other functionality works fine; the only thing that seems to fail is
not getting an error when the AsyncContext is actually not connected

I did some debugging into the Tomcat code, and it seems like all of the
code "just works" without ever noticing a problem. It is hard to be sure
because a lot of it runs in different threads and is hard to follow... It
would help already if someone could point me to where Tomcat is supposed to
notice a problem like this (closed remote socket).

Can anyone help to shed some light on this issue?

For info: I'm using the following infra:

Tomcat 9.0.20
Java 11.0.3 (Zulu, OpenJDK)
Ubuntu 18.04



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message