Giter Club home page Giter Club logo

Comments (4)

akarnokd avatar akarnokd commented on June 2, 2024 1

Yes, that can happen because the new thread worker has to be shut down in some way to not leak it. Operators cancel eagerly and thus this interrupt via shutdownNow can happen while still being on the same thread.

Could you use a different scheduler instead, such as IO or from with a custom executor? Those would not shutdownNow like the vanilla newThread.

from rxjava.

joshallenit avatar joshallenit commented on June 2, 2024

Thanks for the tip! Using Schedulers.from(executor) directly avoids this issue. We are using executor.asCoroutineDispatcher().asScheduler() so that we can share threads between coroutines and Rx using limitedParallelism. That leads to this interrupted issue, from a different mechanism then shutdownNow.

 	at xxx.RxIoThread.interrupt(MonotonicThreadFactory.kt:25)
 	at kotlinx.coroutines.ThreadState.invoke(Interruptible.kt:145)
 	at kotlinx.coroutines.ThreadState.invoke(Interruptible.kt:62)
 	at kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1428)
 	at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
 	at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
 	at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
 	at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
 	at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
 	at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
 	at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
 	at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
 	at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
 	at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
 	at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
 	at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
 	at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
 	at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:901)
 	at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:864)
 	at kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:697)
 	at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:668)
 	at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:633)
 	at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:618)
 	at kotlinx.coroutines.Job$DefaultImpls.cancel$default(Job.kt:195)
 	at kotlinx.coroutines.rx3.DispatcherScheduler$DispatcherWorker.dispose(RxScheduler.kt:92)
 	at io.reactivex.rxjava3.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.cancel(FlowableSubscribeOn.java:142)

from rxjava.

akarnokd avatar akarnokd commented on June 2, 2024

Oh, that's a hefty kotlinx stacktrace.

I don't know what and why they do it that way. It's out of control of Rx as we only issue a dispose to the worker.

from rxjava.

joshallenit avatar joshallenit commented on June 2, 2024

Okay, closing this then, thanks for the help!

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.