-
Notifications
You must be signed in to change notification settings - Fork 68
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
Coroutine execution always performed with dispatch if the dispatcher is bound to a DuplicatedContext #243
Comments
…is bound to a DuplicatedContext Fixes vert-x3#243 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Fixed by #244 |
Thanks @tsegismont ! Hopefully the last thing along these lines: I think you might be missing the following override in the new class
With the override the timeout functionality will run with While without the override, it will rely on For example, with the override and the code like this
while without the override it's The issue doesn't change correctness, to be sure, but users might expect the functionality to stay exclusively with the Vert.x threads |
@bbyk Thanks for you thorough review I've tried to reproduce but the test passes: @Test
fun `test withTimeout execution dispatched on Vertx coroutine executor`(testContext: TestContext) {
val latch = testContext.async()
val context = (vertx as VertxInternal).getOrCreateContext()
val duplicatedContext = context.duplicate()
val promise = Promise.promise<Any>()
duplicatedContext.runOnContext {
GlobalScope.launch(vertx.dispatcher()) {
try {
withTimeout(100) {
promise.future().await()
}
} catch (e: TimeoutCancellationException) {
testContext.assertEquals(ContextInternal.current(), duplicatedContext)
latch.complete()
}
}
}
} Can you share your reproducer? |
@tsegismont I am sharing it below for a different concurrency primitive. But first I'd like to mention again that the missing override doesn't change correctness of You can have a more contrived case, though, that actually fails in a test. E.g. the following test fails ( a kludge: when you paste the sketched code, please remove
|
…is bound to a DuplicatedContext (vert-x3#244) Fixes vert-x3#243 Signed-off-by: Thomas Segismont <tsegismont@gmail.com>
Got you. This will be fixed by #246 |
Regression introduced by #234 and reported by @bbyk in #234 (comment)
The text was updated successfully, but these errors were encountered: