-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Flow builder does not work from suspend fun main (IllegalStateException) #2044
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
Comments
I just ran into this issue when using my library fluid-mongo from Wrapping everything in
|
elizarov
added a commit
that referenced
this issue
Jul 2, 2020
elizarov
added a commit
that referenced
this issue
Jul 2, 2020
elizarov
added a commit
that referenced
this issue
Sep 11, 2020
recheej
pushed a commit
to recheej/kotlinx.coroutines
that referenced
this issue
Dec 28, 2020
This is leftover from Kotlin#2044 fix. Fixes Kotlin#2241
recheej
pushed a commit
to recheej/kotlinx.coroutines
that referenced
this issue
Dec 28, 2020
recheej
pushed a commit
to recheej/kotlinx.coroutines
that referenced
this issue
Dec 28, 2020
This is leftover from Kotlin#2044 fix. Fixes Kotlin#2241
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The bug was introduced by #2028. Run this code:
Result:
Exception in thread "main" java.lang.IllegalStateException: Context cannot be checked for liveness because it does not have a job: EmptyCoroutineContext
As a larger problem, now implementation details of the flow are leaking outside of it. If the flow is cancellable via
flow { ... }
builder orcancellable()
operation, it cannot be used from the empty context.The proposed solution is to fix
ensureActive
so that it does not throw on empty context.The text was updated successfully, but these errors were encountered: