Reproducing org.eclipse.jetty.io.EofException: Closed

714 views
Skip to first unread message

Laverne Schrock

unread,
Jan 3, 2020, 9:06:17 PM1/3/20
to Ring
We're using ring-jetty-adapter 1.8.0 with async middleware & handlers. (org.eclipse.jetty/jetty-server 9.4.22.v20191022)

For reasons that aren't especially clear we have a try/catch around the final call to the callback `respond` and it is occasionally catching the following exception in our production environment:

org.eclipse.jetty.io.EofException: Closed
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:766)
at java.io.FilterOutputStream.write(FilterOutputStream.java:77)
at ring.util.servlet.proxy$java.io.FilterOutputStream$ff19274a.write(Unknown Source)
at java.io.FilterOutputStream.write(FilterOutputStream.java:125)
at ring.util.servlet.proxy$java.io.FilterOutputStream$ff19274a.write(Unknown Source)
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
at sun.nio.cs.StreamEncoder.implClose(StreamEncoder.java:316)
at sun.nio.cs.StreamEncoder.close(StreamEncoder.java:149)
at java.io.OutputStreamWriter.close(OutputStreamWriter.java:233)
at java.io.BufferedWriter.close(BufferedWriter.java:266)
at ring.core.protocols$eval63747$fn__63748.invoke(protocols.clj:26)
at ring.core.protocols$eval63720$fn__63721$G__63711__63730.invoke(protocols.clj:8)
at ring.util.servlet$update_servlet_response.invokeStatic(servlet.clj:106)
at ring.util.servlet$update_servlet_response.invoke(servlet.clj:91)
at ring.adapter.jetty$async_proxy_handler$fn__63848$fn__63849.invoke(jetty.clj:39)

I've omitted the rest of the stacktrace since it doesn't seem useful to include reference to all our middleware.

My understanding is that this is normal behavior when a client drops a connection, but I've been unable to reproduce this scenario locally.

Two questions:
1) Am I correct in thinking that this is fine behavior?
2) Any ideas on how to reproduce this?

Thanks,
Laverne

Phill Wolf

unread,
Jan 5, 2020, 6:36:21 PM1/5/20
to Ring

There is also this very amusing possibility:

https://github.com/eclipse/jetty.project/issues/2867 "Connection getting closed by jetty before passing the whole response"

(Punch line: if the servlet does not fully consume the whole entire request body...)

Reply all
Reply to author
Forward
0 new messages