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

StackOverflowError caused by two yield calls #233

Closed
chemist777 opened this issue May 16, 2023 · 4 comments
Closed

StackOverflowError caused by two yield calls #233

chemist777 opened this issue May 16, 2023 · 4 comments
Assignees
Labels
Milestone

Comments

@chemist777
Copy link

chemist777 commented May 16, 2023

Version

Which version(s) did you encounter this bug ?

vertx-lang-kotlin-coroutines 4.4.2
kotlinx-coroutines-core: 1.6.1

Context

I encountered an exception while writing two consecutive yield calls in a CoroutineVerticle.

Do you have a reproducer?

A reproducer:

@Test
fun bug(): Unit = runBlocking {
    // it's a workaround to show correct exceptions instead of NoClassDefFoundError
    Class.forName("kotlinx.coroutines.CoroutineExceptionHandlerImplKt")
    Class.forName("kotlin.internal.PlatformImplementationsKt")
    // actual reproducer
    val vertx = Vertx.vertx()
    val dispatcher = vertx.orCreateContext.dispatcher()
    val scope = CoroutineScope(dispatcher + SupervisorJob())
    scope.async {
        (0 until 1000).forEach {
            yield()
            yield()
        }
    }.await()
}

Steps to reproduce

  1. Run the snippet.
  2. Observe a hang and the following StackOverflowError:
Exception in thread "vert.x-eventloop-thread-0 @coroutine#2" java.lang.RuntimeException: Exception while trying to handle coroutine exception
	at kotlinx.coroutines.CoroutineExceptionHandlerKt.handlerException(CoroutineExceptionHandler.kt:38)
	at kotlinx.coroutines.CoroutineExceptionHandlerKt.handleCoroutineException(CoroutineExceptionHandler.kt:29)
	at kotlinx.coroutines.DispatchedTask.handleFatalException(DispatchedTask.kt:146)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:115)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:128)
	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:37)
	at io.coinmetrics.httpserver.ProcessingPoolTest$bug$1$1.invokeSuspend(ProcessingPoolTest.kt:115)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:128)
	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:37)
	at io.coinmetrics.httpserver.ProcessingPoolTest$bug$1$1.invokeSuspend(ProcessingPoolTest.kt:114)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:128)
	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:37)
	at io.coinmetrics.httpserver.ProcessingPoolTest$bug$1$1.invokeSuspend(ProcessingPoolTest.kt:115)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at io.vertx.kotlin.coroutines.VertxCoroutineExecutor.execute(VertxCoroutine.kt:218)
	at kotlinx.coroutines.ExecutorCoroutineDispatcherImpl.dispatch(Executors.kt:128)
	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:37)
	at io.coinmetrics.httpserver.ProcessingPoolTest$bug$1$1.invokeSuspend(ProcessingPoolTest.kt:114)
        ... and so on (a recursion) 

Most likely, the error is caused by the following fragment in VertxCoroutine.kt:

  override fun execute(command: Runnable) {
    if (Vertx.currentContext() != vertxContext) {
      vertxContext.runOnContext { command.run() }
    } else {
      command.run()
    }
  }

Extra

Java 11

@chemist777 chemist777 added the bug label May 16, 2023
@vietj
Copy link
Contributor

vietj commented May 17, 2023

what does happen with a regular kotlin coroutine ?

@chemist777
Copy link
Author

chemist777 commented May 17, 2023

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()
}

@chemist777
Copy link
Author

chemist777 commented Oct 6, 2023

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 ....

@tsegismont tsegismont added this to the 4.4.6 milestone Oct 6, 2023
tsegismont added a commit to tsegismont/vertx-lang-kotlin that referenced this issue Oct 6, 2023
See vert-x3#233

As an optimization, VertxCoroutineExecutor used to execute the command immediately if running on the right context (the context provided at creation time or one of its duplicates).

But this is not compliant with the CoroutineDispacther contract: invocations of dispatch should actually defer execution.

Instead, we introduce a custom CoroutineDispatcher that implements isDispatchNeeded.
This method shall return false in the optimization can be applied.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit that referenced this issue Oct 6, 2023
See #233

As an optimization, VertxCoroutineExecutor used to execute the command immediately if running on the right context (the context provided at creation time or one of its duplicates).

But this is not compliant with the CoroutineDispacther contract: invocations of dispatch should actually defer execution.

Instead, we introduce a custom CoroutineDispatcher that implements isDispatchNeeded.
This method shall return false in the optimization can be applied.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit to tsegismont/vertx-lang-kotlin that referenced this issue Oct 6, 2023
See vert-x3#233

As an optimization, VertxCoroutineExecutor used to execute the command immediately if running on the right context (the context provided at creation time or one of its duplicates).

But this is not compliant with the CoroutineDispacther contract: invocations of dispatch should actually defer execution.

Instead, we introduce a custom CoroutineDispatcher that implements isDispatchNeeded.
This method shall return false in the optimization can be applied.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit to tsegismont/vertx-lang-kotlin that referenced this issue Oct 6, 2023
See vert-x3#233

As an optimization, VertxCoroutineExecutor used to execute the command immediately if running on the right context (the context provided at creation time or one of its duplicates).

But this is not compliant with the CoroutineDispacther contract: invocations of dispatch should actually defer execution.

Instead, we introduce a custom CoroutineDispatcher that implements isDispatchNeeded.
This method shall return false in the optimization can be applied.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
@tsegismont
Copy link
Contributor

Fixed by #242

tsegismont added a commit that referenced this issue Oct 6, 2023
See #233

As an optimization, VertxCoroutineExecutor used to execute the command immediately if running on the right context (the context provided at creation time or one of its duplicates).

But this is not compliant with the CoroutineDispacther contract: invocations of dispatch should actually defer execution.

Instead, we introduce a custom CoroutineDispatcher that implements isDispatchNeeded.
This method shall return false in the optimization can be applied.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
tsegismont added a commit that referenced this issue Oct 6, 2023
See #233

As an optimization, VertxCoroutineExecutor used to execute the command immediately if running on the right context (the context provided at creation time or one of its duplicates).

But this is not compliant with the CoroutineDispacther contract: invocations of dispatch should actually defer execution.

Instead, we introduce a custom CoroutineDispatcher that implements isDispatchNeeded.
This method shall return false in the optimization can be applied.

Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
@tsegismont tsegismont self-assigned this Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants