org.eclipse.jetty.io.EofException

278 views
Skip to first unread message

Tim Schaub

unread,
Jan 5, 2011, 1:51:02 PM1/5/11
to rin...@googlegroups.com
I'm proxying requests to a server that is timing out (perhaps) or
otherwise doing something to result in a EoF exception while reading the
exchange.contentBytes.

Here's my proxy module: https://gist.github.com/636779

And the trace is below.

I've been ignoring these exceptions, unsure where I should be catching
them. Perhaps it is unrelated, but I'm also seeing memory errors
(java.lang.OutOfMemoryError: unable to create new native thread), and
I'm curious if I'm leaking memory by not properly handling the EoF
exception.

I know this is fairly specific, but can someone suggest that I should be
doing something different when passing an exchange.contentBytes as a
JSGI response body (I'm currently wrapping it with a MemoryStream).

Thanks for any tips,
Tim


org.mozilla.javascript.WrappedException: Wrapped
org.eclipse.jetty.io.EofException (ringo/jsgi.js#125)
at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1781)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:183)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:247)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at
org.mozilla.javascript.gen.ringo_jsgi_js_45._c_anonymous_9(ringo/jsgi.js:125)
at org.mozilla.javascript.gen.ringo_jsgi_js_45.call(ringo/jsgi.js)
at
org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2504)
at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:300)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:129)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:76)
at org.mozilla.javascript.gen.io_js_21._c_anonymous_2(io.js:51)
at org.mozilla.javascript.gen.io_js_21.call(io.js)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at
org.mozilla.javascript.gen.ringo_jsgi_js_45._c_writeBody_8(ringo/jsgi.js:127)
at org.mozilla.javascript.gen.ringo_jsgi_js_45.call(ringo/jsgi.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
at
org.mozilla.javascript.gen.ringo_jsgi_js_45._c_writeResponse_5(ringo/jsgi.js:101)
at org.mozilla.javascript.gen.ringo_jsgi_js_45.call(ringo/jsgi.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
at
org.mozilla.javascript.gen.ringo_jsgi_js_45._c_commitResponse_4(ringo/jsgi.js:93)
at org.mozilla.javascript.gen.ringo_jsgi_js_45.call(ringo/jsgi.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
at
org.mozilla.javascript.gen.ringo_jsgi_js_45._c_handleRequest_1(ringo/jsgi.js:45)
at org.mozilla.javascript.gen.ringo_jsgi_js_45.call(ringo/jsgi.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)
at org.mozilla.javascript.gen.ringo_jsgi_js_45.call(ringo/jsgi.js)
at org.ringojs.engine.RhinoEngine.invoke(RhinoEngine.java:257)
at org.ringojs.jsgi.JsgiServlet.service(JsgiServlet.java:130)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:527)
at
org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:423)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at
org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:493)
at
org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225)
at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:930)
at
org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:358)
at
org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:866)
at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:245)
at
org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:113)
at org.eclipse.jetty.server.Server.handle(Server.java:351)
at
org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:594)
at
org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1042)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:549)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:211)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:506)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
at java.lang.Thread.run(Thread.java:680)
Caused by: org.eclipse.jetty.io.EofException
at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:905)
at
org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:499)
at
org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:430)
at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:78)
at
org.eclipse.jetty.server.HttpConnection$Output.flush(HttpConnection.java:1133)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:159)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:98)
at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
... 50 more
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:100)
at sun.nio.ch.IOUtil.write(IOUtil.java:56)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:187)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:273)
at org.eclWrapped org.eclipse.jetty.io.EofException (ringo/jsgi.js#125)
at ringo/jsgi.js:125 (anonymous)
at io.js:51 (anonymous)
at ringo/jsgi.js:127 (writeBody)
at ringo/jsgi.js:101 (writeResponse)
at ringo/jsgi.js:93 (commitResponse)
at ringo/jsgi.js:45 (handleRequest)

ipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:849)
... 60 more

Simon Oberhammer

unread,
Jan 5, 2011, 2:08:44 PM1/5/11
to RingoJS
> Tim Schaub <tim.sch...@gmail.com> wrote:
> I'm proxying requests to a server that is timing out (perhaps) or
> otherwise doing something to result in a EoF exception while reading the
> exchange.contentBytes.
>
> Here's my proxy module:https://gist.github.com/636779

Wondering: but the response status is 200 at first and some data comes
in? If you do a synchronous request, like the gist shows, you could
check `exchange.status` before accessing the contentBytes.

simon

Tim Schaub

unread,
Jan 5, 2011, 2:47:02 PM1/5/11
to rin...@googlegroups.com

I'll see about checking the status first. But even in the case of a non
200 response, I'd still like to pass along the body.

Tim

>
> simon
>

Reply all
Reply to author
Forward
0 new messages