ReactiveX / RxJavaReactiveStreams

Adapter between RxJava and ReactiveStreams

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SingleAsPublisher hangs on subscribe(Subscriber) call

andrey-radchenko opened this issue · comments

The subscribe(Subscriber s) method calls s.onSubscribe(...), which in turn calls request(n) and goes into infinite loop waiting for wrapped single to complete. But actual Single has not been subscribed to yet and therefore infinite loop will never end.

    @Override
    public void subscribe(Subscriber<? super T> s) {
        SingleAsPublisherSubscriber<T> parent = new SingleAsPublisherSubscriber<T>(s);
        s.onSubscribe(parent); // apparently, this goes into infinite loop and never returns

        single.subscribe(parent);
    }

Fixed via #156