-
Enhancement
-
Resolution: Unresolved
-
Major
-
None
-
4.6.0.Final
-
None
-
User Experience
-
Undefined
Given a JAX-RS resource method that returns a reactive stream (with an output media type of text/event-stream), each connection is associated with a corresponding Subscription. If a client disconnects by resetting the connection, the Subscription stays around until the next time SseEventOutputImpl#internalFlushResponseToClient is called even though the HTTP connection is closed immediately. If the connection is mostly idle, this can cause dead Subscriptions to pile up, resulting in a memory leak.
Sending artificial keepalive events to clients is a possible workaround, but in my opinion, avoiding the problem in the first place would be nicer.
I haven't checked other back ends, but at least the Vert.x back end appears capable of propagating connection close events upwards as they happen (via io.vertx.core.http.HttpServerResponse#closeHandler, for instance). It would be nice if RESTEasy freed Subscriptions and other resources promptly in such cases.