Data push overload?

Hello,

I have an application that pushes a lot of data to the client once a second, every second. Sometimes, if I open additional windows (more data is pushed) the browser chokes and I get the exception below.

I’m using
vaadin7.6.3
jetty-distribution-9.2.11.v20150529

It seems perhaps it may be a Jetty issue. My code does not appear anywhere on the stack trace. I don’t have a clear idea what to do about this. Would it be possible for the client to send back a heartbeat after it consumes all the data? maybe in this way the server would know to skip the next push if it overruns the one-second frame.

I would like to ask your advice on how to mitigate this problem.

Mar 30, 2016 3:11:20 PM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
org.eclipse.jetty.io.EofException
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:192)
at org.eclipse.jetty.io.WriteFlusher.flush(WriteFlusher.java:408)
at org.eclipse.jetty.io.WriteFlusher.write(WriteFlusher.java:302)
at org.eclipse.jetty.io.AbstractEndPoint.write(AbstractEndPoint.java:129)
at org.eclipse.jetty.server.HttpConnection$SendCallback.process(HttpConnection.java:684)
at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:246)
at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:208)
at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:480)
at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:768)
at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:801)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:147)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:140)
at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:383)
at com.vaadin.server.DownloadStream.writeResponse(DownloadStream.java:306)
at com.vaadin.server.AbstractClientConnector.handleConnectorRequest(AbstractClientConnector.java:677)
at com.vaadin.server.ConnectorResourceHandler.handleRequest(ConnectorResourceHandler.java:90)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1409)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:499)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.writev0(Native Method)
at sun.nio.ch.SocketDispatcher.writev(SocketDispatcher.java:51)
at sun.nio.ch.IOUtil.write(IOUtil.java:148)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:504)
at org.eclipse.jetty.io.ChannelEndPoint.flush(ChannelEndPoint.java:172)
… 36 more

Hi,

If you want to fetch data every second and you are not sure that the client will be able to handle the update within a second, it might be better to use polling. With polling the communication is initiated by the client and thus if the client is busy it will not ask for more data before it has processed the previous update.

Ok thanks Artur. But do you think that this jetty/vaadin exception may be caused by the push failure?

The jetty exception comes from

    at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:383)
    at com.vaadin.server.DownloadStream.writeResponse(DownloadStream.java:306)
    at com.vaadin.server.AbstractClientConnector.handleConnectorRequest(AbstractClientConnector.java:677)
    at com.vaadin.server.ConnectorResourceHandler.handleRequest(ConnectorResourceHandler.java:90)

which means the browser disconnected from the server while downloading a resource.