Comments (4)
Fixed by #242
from vertx-lang-kotlin.
what does happen with a regular kotlin coroutine ?
from vertx-lang-kotlin.
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.
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)
- Update to Kotlin 1.5.31
- Provide a vertxFuture coroutine builder HOT 2
- ReaderStream<T>.toReceiveChannel return elements in random order HOT 6
- CVE-2021-45105
- CVE-2021-45105
- CVE-2021-45105
- Starting a coroutine on a vert.x worker thread runs it on the same thread but should hand it over to the event loop thread HOT 3
- Upgrade to Kotlin 1.7.21
- Upgrade to Kotlin Coroutines 1.6.4
- Support for Mutiny for CoroutineVerticle for awaitSuspending Support HOT 1
- Add Vert.x core dependency back HOT 1
- Upgrade to 4.4.0 requires stdlib HOT 5
- Coroutine dispatcher doesn't execute commands on the duplicated context HOT 3
- Coroutine execution always performed with dispatch if the dispatcher is bound to a DuplicatedContext HOT 5
- ChannelWriteStream has a bug closing underlying stream HOT 3
- Add Future.coAwait and deprecate Future.await HOT 1
- Upgrade to Kotlin 1.9
- Kotlin fixes HOT 1
- #### I'm hacked without permission for anyone to do so ####
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vertx-lang-kotlin.