Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-users] EventSourceServlet timing out

This is Jetty 12.1.18, but also exists in prior versions.

My webapp, using the EventSource API kept getting called on the onerror function. Not all the time, it does receive data from the org.eclipse.jetty.ee11.servlets.EventSource implementation.

I turned on debugging to figure out what was going on, and it seems like a TimeoutException is triggering the EventSource.onClose() method. I’m pretty sure this shouldn’t happen, as this code (from EventSourceServlet) is presumably disabling timeouts:

respond(request, response);
AsyncContext async = request.startAsync();
// Infinite timeout because the continuation is never resumed
// but only completed on close
async.setTimeout(0);
EventSourceEmitter emitter = new EventSourceEmitter(eventSource, async);
emitter.heartBeat = scheduler.schedule(emitter, heartBeatPeriod, TimeUnit.SECONDS);
open(eventSource, emitter);

but, alas, something is not going as expected. I've attached a screenshot of the debugger:

Screenshot 2026-04-06 133742.pngScreenshot 2026-04-06 133856.png



Back to the top