Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsubscribing an SSE stream does not close the underlying connection #111

Closed
g9yuayon opened this issue May 3, 2014 · 1 comment
Closed
Labels
Milestone

Comments

@g9yuayon
Copy link
Contributor

g9yuayon commented May 3, 2014

When an observable of an ServerSentEvent from a request is subscribed, the underly connection is not closed. As a result, the server that serves the SSE streams will continue sending events. The server will also throw an exception if it finishes sending all the events:

Unexpected error in RxNetty. Error: Connection reset by peer
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
    at sun.nio.ch.IOUtil.read(IOUtil.java:192)
    at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
    at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:311)
    at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:871)
    at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:208)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:118)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:485)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346)
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101)
    at java.lang.Thread.run(Thread.java:744)
@NiteshKant NiteshKant added the bug label May 20, 2014
@NiteshKant NiteshKant added this to the 0.3.6 milestone May 23, 2014
@NiteshKant NiteshKant self-assigned this May 23, 2014
@NiteshKant
Copy link
Member

I chatted with @g9yuayon offline and this seems to be only happening if the content subscription and HttpClientResponse subscriptions are not connected, eg: via response.flatmap()

This as expected, we manage the "liveness" of a response & the underlying connection via the response observable.

Closing the issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants