Giter Club home page Giter Club logo

Comments (4)

tsegismont avatar tsegismont commented on June 25, 2024 1

Fixed by #242

from vertx-lang-kotlin.

vietj avatar vietj commented on June 25, 2024

what does happen with a regular kotlin coroutine ?

from vertx-lang-kotlin.

chemist777 avatar chemist777 commented on June 25, 2024

what does happen with a regular kotlin coroutine ?

The following code works well with regular thread pools. The problem is related to the thread pool managed by Vert.x/vertx-lang-kotlin.

@Test
fun `it works well with standard dispatchers`(): Unit = runBlocking {
    val dispatcher = Executors.newFixedThreadPool(4).asCoroutineDispatcher()
    val scope = CoroutineScope(dispatcher + SupervisorJob())
    scope.async {
        (0 until 1000).forEach {
            yield()
            yield()
        }
    }.await()
}

from vertx-lang-kotlin.

chemist777 avatar chemist777 commented on June 25, 2024

Any updates on this? I face this problem regularly when trying to use yield() in Verticles even with a single yield() call in some cases.

A stack trace from a real-world app when the latest coroutines and vert.x libraries are used:

Exception in thread "vert.x-eventloop-thread-7 @coroutine#14" kotlinx.coroutines.CoroutinesInternalError: Fatal exception in coroutines machinery for DispatchedContinuation[io.vertx.kotlin.coroutines.VertxCoroutineExecutor@566364d, Continuation at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)@58efcec1]. Please read KDoc to 'handleFatalException' method and report this incident to maintainers
	at kotlinx.coroutines.DispatchedTask.handleFatalException$kotlinx_coroutines_core(DispatchedTask.kt:146)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:117)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:370)
	at io.coinmetrics.httpserver.impl.VertxHttpServerImpl$Verticle$sendResponse$3$1.emit(VertxHttpServerImpl.kt:358)
	at kotlinx.coroutines.flow.CancellableFlowImpl$collect$2.emit(Context.kt:275)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:37)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
	at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:135)
	at kotlinx.coroutines.CoroutineDispatcher.dispatchYield(CoroutineDispatcher.kt:150)
	at kotlinx.coroutines.internal.DispatchedContinuation.dispatchYield$kotlinx_coroutines_core(DispatchedContinuation.kt:264)
	at kotlinx.coroutines.YieldKt.yield(Yield.kt:36)
... stack is repeated in a loop ....

from vertx-lang-kotlin.

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.