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

mono { } with timeout never completes #2262

Closed
frost13it opened this issue Sep 22, 2020 · 0 comments
Closed

mono { } with timeout never completes #2262

frost13it opened this issue Sep 22, 2020 · 0 comments
Assignees

Comments

@frost13it
Copy link

Expected behaviour:
When a coroutine inside mono { } fails with a TimeoutCancellationException, the returned Mono terminates with an error.

Actual behaviour:
The returned Mono never completes.

Example:

import kotlinx.coroutines.delay
import kotlinx.coroutines.reactor.mono
import kotlinx.coroutines.withTimeout

fun main() {
    val mono = mono {
        withTimeout(1) { delay(100) }
    }
    mono.doOnSubscribe { println("Subscribed") }
        .doOnNext { println("Emitted: $it") }
        .doOnSuccess { println("Completed") }
        .doOnError { println("Error: $it") }
        .doOnCancel { println("Cancelled") }
        .block()
    println("Done")
}

The code above prints Subscribed and hangs forever.

It seems that such behaviour is introduced in #1638.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants