You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Lukasz Wysocki (JIRA)" <ji...@apache.org> on 2018/10/12 14:30:00 UTC

[jira] [Commented] (CXF-7874) JAX-RS SSE Leaking SSESink (s)

    [ https://issues.apache.org/jira/browse/CXF-7874?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16647965#comment-16647965 ] 

Lukasz Wysocki commented on CXF-7874:
-------------------------------------

the cxf-7874.reproduce.patch that is attached modifies:
systests/rs-sse/rs-sse-base/src/main/java/org/apache/cxf/systest/jaxrs/sse/AbstractSseTest.java
systests/rs-sse/rs-sse-base/src/main/java/org/apache/cxf/systest/jaxrs/sse/BookStore.java

that reproduces the problem. Note that this is not a test, it's my experimentation code, reproducing the problem.
The effect is that when running the jetty based tests rs-sse-jetty produces in the log:
...
[ERROR] 2018-10-12 16:22:36.259 o.a.cxf.systest.jaxrs.sse.BookStore - [] Sent 1
[ERROR] 2018-10-12 16:22:39.263 o.a.cxf.systest.jaxrs.sse.BookStore - [] Sent 2
[ERROR] 2018-10-12 16:22:40.264 o.a.cxf.systest.jaxrs.sse.BookStore - [] Sent 3
[ERROR] 2018-10-12 16:22:40.268 o.a.cxf.systest.jaxrs.sse.BookStore - [] 3 Sink isClosed?: false Got an exception org.eclipse.jetty.io.EofException
[ERROR] 2018-10-12 16:22:41.265 o.a.cxf.systest.jaxrs.sse.BookStore - [] 4 Sink isClosed?: false Got an exception org.eclipse.jetty.io.EofException: Closed
[ERROR] 2018-10-12 16:22:41.265 o.a.cxf.systest.jaxrs.sse.BookStore - [] Sent 4
[ERROR] 2018-10-12 16:22:42.267 o.a.cxf.systest.jaxrs.sse.BookStore - [] 5 Sink isClosed?: false Got an exception org.eclipse.jetty.io.EofException: Closed
[ERROR] 2018-10-12 16:22:42.267 o.a.cxf.systest.jaxrs.sse.BookStore - [] Sent 5
[ERROR] 2018-10-12 16:22:47.269 o.a.cxf.systest.jaxrs.sse.BookStore - [] 6 Sink isClosed?: false Got an exception org.eclipse.jetty.io.EofException: Closed
[ERROR] 2018-10-12 16:22:47.270 o.a.cxf.systest.jaxrs.sse.BookStore - [] Sent 6
[ERROR] 2018-10-12 16:22:47.270 o.a.cxf.systest.jaxrs.sse.BookStore - [] Close sink
[ERROR] 2018-10-12 16:22:47.270 o.a.cxf.systest.jaxrs.sse.BookStore - [] got onClose callback
...

Which matched to the patched code of BookStore.java shows that:
* No callback on SseSinkImpl when client closes the channel,
* that SseSink is open (isClosed=false), even dough client end is closed and we get repeted EofException for each send
* that SseBrodcaster also is not infored of Sink being closed
* and finally that sink is closed and removed from broadcaster only after server side sseSink.close() call

hence mentioned leakage of SseSinks in case where it is the client that is managing the lifetime of sse connection.


> JAX-RS SSE Leaking SSESink (s)
> ------------------------------
>
>                 Key: CXF-7874
>                 URL: https://issues.apache.org/jira/browse/CXF-7874
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.6
>         Environment: Observed on karaf (jetty).
> Reproduced on jetty by modifying cxf SSE tests.
>            Reporter: Lukasz Wysocki
>            Priority: Major
>         Attachments: cxf-7874.reproduce.patch
>
>
> Closing of SSE connection by client is not detected and handled on the server part.
> This results in server leaking resources when it is the clients responsibility for deciding on the lifetime of SSE connection.
> Scenario is status notifications of devices are sent to client (browser), this is a continues stream that lives until browser tab/window is closed, which results in client end closing the underlying connection.
> SseSinkImpl is not informed of connection being closed. 
> At the same time exception set on future in  org.apache.cxf.jaxrs.sse.SseEventSinkImpl#dequeue in case of channel being closed is not acted upon internally within SseSinkImpl.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)