Git Product home page Git Product logo

Comments (6)

gustavomahlow avatar gustavomahlow commented on June 14, 2024

Another stack trace obtained via jstack:

   java.lang.Thread.State: RUNNABLE
	at io.reactivex.internal.queue.SpscLinkedArrayQueue.lvElement(SpscLinkedArrayQueue.java:251)
	at io.reactivex.internal.queue.SpscLinkedArrayQueue.poll(SpscLinkedArrayQueue.java:138)
	at io.reactivex.internal.queue.SpscLinkedArrayQueue.clear(SpscLinkedArrayQueue.java:186)
	at io.reactivex.internal.operators.flowable.FlowableOnBackpressureBuffer$BackpressureBufferSubscriber.cancel(FlowableOnBackpressureBuffer.java:154)
	at io.reactivex.internal.subscribers.BasicFuseableSubscriber.cancel(BasicFuseableSubscriber.java:158)
	at io.reactivex.internal.subscriptions.SubscriptionHelper.cancel(SubscriptionHelper.java:181)
	at io.reactivex.internal.subscribers.StrictSubscriber.cancel(StrictSubscriber.java:77)
	at graphql.execution.reactive.DelegatingSubscription.cancel(DelegatingSubscription.java:26)
	at graphql.kickstart.execution.subscriptions.SessionSubscriptions.cancel(SessionSubscriptions.java:37)
	at graphql.kickstart.execution.subscriptions.DefaultSubscriptionSession.unsubscribe(DefaultSubscriptionSession.java:47)
	at graphql.kickstart.execution.subscriptions.apollo.SubscriptionStopCommand.apply(SubscriptionStopCommand.java:15)
	at graphql.kickstart.execution.subscriptions.apollo.ApolloSubscriptionConsumer.accept(ApolloSubscriptionConsumer.java:25)
	at graphql.kickstart.execution.subscriptions.apollo.ApolloSubscriptionConsumer.accept(ApolloSubscriptionConsumer.java:11)
	at graphql.kickstart.servlet.GraphQLWebsocketServlet$1.onMessage(GraphQLWebsocketServlet.java:146)
	at graphql.kickstart.servlet.GraphQLWebsocketServlet$1.onMessage(GraphQLWebsocketServlet.java:142)
	at org.apache.tomcat.websocket.WsFrameBase.sendMessageText(WsFrameBase.java:415)
	at org.apache.tomcat.websocket.server.WsFrameServer.sendMessageText(WsFrameServer.java:129)
	at org.apache.tomcat.websocket.WsFrameBase.processDataText(WsFrameBase.java:515)
	at org.apache.tomcat.websocket.WsFrameBase.processData(WsFrameBase.java:301)
	at org.apache.tomcat.websocket.WsFrameBase.processInputBuffer(WsFrameBase.java:133)
	at org.apache.tomcat.websocket.server.WsFrameServer.onDataAvailable(WsFrameServer.java:85)
	at org.apache.tomcat.websocket.server.WsFrameServer.doOnDataAvailable(WsFrameServer.java:183)
	at org.apache.tomcat.websocket.server.WsFrameServer.notifyDataAvailable(WsFrameServer.java:162)
	at org.apache.tomcat.websocket.server.WsHttpUpgradeHandler.upgradeDispatch(WsHttpUpgradeHandler.java:156)
	at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:59)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1707)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	- locked <0x00000006c8a00140> (a org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper)
	at java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1128)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:628)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run([email protected]/Thread.java:830)

It seems that poll() call is always returning a value different than null.

from rxjava.

akarnokd avatar akarnokd commented on June 14, 2024

An infinite loop in clear usually indicates some part of the flow called an onNext concurrently at some point, which is not allowed.

Anything non-standard is your attachListener so if whatever drives the the emitter in there gets called concurrently, you'll get a corrupted queue.

from rxjava.

gustavomahlow avatar gustavomahlow commented on June 14, 2024

The serialized observer can resolve this issue for me? Or I have to synchronize onNext call by myself?
The way we implemented, onNext call be called concurrently.

The attach listener call, wraps a ApplicationListener from spring (A listener that receives application events that happened)(It can be asynchronous) and make it call onNext every time a new evened is received.

from rxjava.

akarnokd avatar akarnokd commented on June 14, 2024

-> https://reactivex.io/RxJava/2.x/javadoc/io/reactivex/ObservableEmitter.html

Observable.create(emitter -> {
   ObservableEmitter<T> serializedEmitter = emitter.serialize();

  someApi.addListener(data -> {
       serializedEmitter.onNext(data);
  });
});

from rxjava.

gustavomahlow avatar gustavomahlow commented on June 14, 2024

Just to confirm. A concrete example:

        ConnectableObservable<T> connectableObservable =
                Observable.create(emitter -> {
                    ObservableEmitter<T> serializedEmitter = emitter.serialize();
                    
                    configurableApplicationContext.addApplicationListener(event -> serializedEmitter::onNext);
                }).share().publish();
        connectableObservable.connect();

        return connectableObservable.toFlowable(BackpressureStrategy.BUFFER);

My observer should call serialize as well?

        ConnectableObservable<T> connectableObservable =
                Observable.create(emitter -> {
                    ObservableEmitter<T> serializedEmitter = emitter.serialize();
                    
                    configurableApplicationContext.addApplicationListener(event -> serializedEmitter::onNext);
                }).serialize().share().publish();
        connectableObservable.connect();

        return connectableObservable.toFlowable(BackpressureStrategy.BUFFER);

Thanks a lot for your help!

from rxjava.

akarnokd avatar akarnokd commented on June 14, 2024

No need to call serialize() after create.

from rxjava.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.