Giter VIP home page Giter VIP logo

ninja-undertow's People

Contributors

dpoineau avatar jfendler avatar jjlauer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ninja-undertow's Issues

Exceptions thrown when client closes the connection

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.