-
Notifications
You must be signed in to change notification settings - Fork 66
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
Comments
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()
} |
Any updates on this? I face this problem regularly when trying to use A stack trace from a real-world app when the latest coroutines and vert.x libraries are used:
|
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>
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>
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>
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>
Fixed by #242 |
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>
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>
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:
Steps to reproduce
Most likely, the error is caused by the following fragment in VertxCoroutine.kt:
Extra
Java 11
The text was updated successfully, but these errors were encountered: