fizzed / ninja-undertow Goto Github PK
View Code? Open in Web Editor NEWUndertow standalone container for NinjaFramework
Undertow standalone container for NinjaFramework
Hi @jjlauer,
with ninja-undertow (instead of using jetty), I get plenty of "Broken Pipe" exceptions, apparently whenever a server response is not fully consumed by the client.
With jetty I had a similar effect, but only when serving large file entities (see Google groups).
Since using undertow the same basic issue seems to occur rather frequently with a lot of requests.
I couldn't really find this issue described anywhere in the undertow forums, so I'm not sure if it's an undertow, or a ninja-undertow issue. I'll try and build a test case for this, since I do believe this is not how it should be. Even if the root cause (IOException while trying to write to the response stream) is thrown by undertow for a reason, I don't believe anybody would want these specific exceptions to show up in production logs (clients close connections all the time..).
Do you have any thoughts or ideas on how to approach this best (perhaps something more elegant than just catching and ignoring the exception)?
Here's the stack trace I get when this happens:
2016-06-02 09:12:53.748 ERROR : Emitting bad request 500. Something really wrong when calling route: / (class: class controllers.ApplicationController method: public ninja.Result controllers.ApplicationControl
ler.index(ninja.Context))
ninja.exceptions.RenderingException: Broken pipe
at ninja.template.TemplateEngineFreemarker.throwRenderingException(TemplateEngineFreemarker.java:378) ~[competix-0.8.4.jar:na]
at ninja.template.TemplateEngineFreemarker.invoke(TemplateEngineFreemarker.java:328) ~[competix-0.8.4.jar:na]
at ninja.utils.ResultHandler.renderWithTemplateEngineOrRaw(ResultHandler.java:116) ~[competix-0.8.4.jar:na]
at ninja.utils.ResultHandler.handleResult(ResultHandler.java:78) ~[competix-0.8.4.jar:na]
at ninja.NinjaDefault.onRouteRequest(NinjaDefault.java:104) ~[competix-0.8.4.jar:na]
at conf.Ninja.onRouteRequest(Ninja.java:677) [competix-0.8.4.jar:na]
at ninja.undertow.NinjaUndertowHandler.handleRequest(NinjaUndertowHandler.java:56) [competix-0.8.4.jar:na]
at ninja.undertow.util.EagerFormParsingHandlerWithCharset.handleRequest(EagerFormParsingHandlerWithCharset.java:60) [competix-0.8.4.jar:na]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) [competix-0.8.4.jar:na]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802) [competix-0.8.4.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:1.8.0_91]
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) ~[na:1.8.0_91]
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) ~[na:1.8.0_91]
at sun.nio.ch.IOUtil.write(IOUtil.java:51) ~[na:1.8.0_91]
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:471) ~[na:1.8.0_91]
at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:152) ~[competix-0.8.4.jar:na]
at io.undertow.server.protocol.http.HttpResponseConduit.write(HttpResponseConduit.java:599) ~[competix-0.8.4.jar:na]
at org.xnio.conduits.AbstractStreamSinkConduit.write(AbstractStreamSinkConduit.java:51) ~[competix-0.8.4.jar:na]
at org.xnio.conduits.ConduitStreamSinkChannel.write(ConduitStreamSinkChannel.java:150) ~[competix-0.8.4.jar:na]
at io.undertow.channels.DetachableStreamSinkChannel.write(DetachableStreamSinkChannel.java:240) ~[competix-0.8.4.jar:na]
at io.undertow.server.HttpServerExchange$WriteDispatchChannel.write(HttpServerExchange.java:2017) ~[competix-0.8.4.jar:na]
at io.undertow.io.UndertowOutputStream.writeBufferBlocking(UndertowOutputStream.java:293) ~[competix-0.8.4.jar:na]
at io.undertow.io.UndertowOutputStream.write(UndertowOutputStream.java:203) ~[competix-0.8.4.jar:na]
at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) ~[na:1.8.0_91]
at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) ~[na:1.8.0_91]
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) ~[na:1.8.0_91]
at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:135) ~[na:1.8.0_91]
at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220) ~[na:1.8.0_91]
at java.io.Writer.write(Writer.java:157) ~[na:1.8.0_91]
at ninja.template.TemplateEngineFreemarker.invoke(TemplateEngineFreemarker.java:323) ~[competix-0.8.4.jar:na]
... 11 common frames omitted
2016-06-02 09:12:53.750 ERROR : Unable to handle result. That's really really fishy.
ninja.exceptions.RenderingException: UT000002: The response has already been started
at ninja.template.TemplateEngineFreemarker.throwRenderingException(TemplateEngineFreemarker.java:378) ~[competix-0.8.4.jar:na]
at ninja.template.TemplateEngineFreemarker.invoke(TemplateEngineFreemarker.java:328) ~[competix-0.8.4.jar:na]
at ninja.utils.ResultHandler.renderWithTemplateEngineOrRaw(ResultHandler.java:116) ~[competix-0.8.4.jar:na]
at ninja.utils.ResultHandler.handleResult(ResultHandler.java:78) ~[competix-0.8.4.jar:na]
at ninja.NinjaDefault.renderErrorResultAndCatchAndLogExceptions(NinjaDefault.java:136) [competix-0.8.4.jar:na]
at ninja.NinjaDefault.onRouteRequest(NinjaDefault.java:110) [competix-0.8.4.jar:na]
at conf.Ninja.onRouteRequest(Ninja.java:677) [competix-0.8.4.jar:na]
at ninja.undertow.NinjaUndertowHandler.handleRequest(NinjaUndertowHandler.java:56) [competix-0.8.4.jar:na]
at ninja.undertow.util.EagerFormParsingHandlerWithCharset.handleRequest(EagerFormParsingHandlerWithCharset.java:60) [competix-0.8.4.jar:na]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) [competix-0.8.4.jar:na]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802) [competix-0.8.4.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]
Caused by: java.lang.IllegalStateException: UT000002: The response has already been started
at io.undertow.server.HttpServerExchange.setStatusCode(HttpServerExchange.java:1365) ~[competix-0.8.4.jar:na]
at ninja.undertow.NinjaUndertowContext.finalizeHeaders(NinjaUndertowContext.java:344) ~[competix-0.8.4.jar:na]
at ninja.utils.AbstractContext.finalizeHeaders(AbstractContext.java:327) ~[competix-0.8.4.jar:na]
at ninja.template.TemplateEngineFreemarker.invoke(TemplateEngineFreemarker.java:321) ~[competix-0.8.4.jar:na]
... 12 common frames omitted
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.