Fork me on GitHub
Mehdi H.11:11:40

Hi all! I am trying out SSE with Pedestal + Jetty. My stream-ready function is really basic and adds an event every second to the channel (with a buffer of 200). For some reason, it takes around a minute to start the stream to the client (cljs + fetch), it bursts around 60 messages and it then ends the stream. Have anyone experienced that? Is it something that could be linked to some Jetty buffering and queue flushing? Thanks in advance!

Mehdi H.13:11:56

This is the error I am getting:

ERROR io.pedestal.http.impl.servlet-interceptor [async-dispatch-3]
{:msg "An error occured when async writing to the client", :line 116, :src-chan #object[clojure.core.async.impl.channels.ManyToManyChannel 0x1ce67b "[email protected]"], :throwable #error {
 :cause "Close [email protected][PROCESSING][i=null,[email protected]] in state PROCESSING"
   :message "Close [email protected][PROCESSING][i=null,[email protected]] in state PROCESSING"
   :at [org.eclipse.jetty.util.IteratingCallback close "" 427]}]
 [[org.eclipse.jetty.util.IteratingCallback close "" 427]
  [org.eclipse.jetty.server.HttpConnection onClose "" 519]
  [ onClose "" 289]
  [ connectionClosed "" 345]
  [$DestroyEndPoint run "" 956]
  [org.eclipse.jetty.util.thread.QueuedThreadPool runJob "" 698]
  [org.eclipse.jetty.util.thread.QueuedThreadPool$Runner run "" 804]
  [java.lang.Thread run "" 748]]}}

Mehdi H.14:11:49

With an event put every 10 seconds in the channel, the error still comes around but the connexion isn't shut down. So maybe the error message isn't linked to the connexion being closed despite the message? And maybe this is a client side issue where the client cannot deal with a one event per second load? Even if this is the case, the 60sec start time for the sse stream to start outputting events is puzzling.