-
Notifications
You must be signed in to change notification settings - Fork 1.9k
kotlin.coroutines.jvm.internal.CompletedContinuation cannot be cast to kotlinx.coroutines.internal.DispatchedContinuation #3005
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
Hi, is there any chance you have a semi-stable reproducer or know the exact pattern of code that triggers this bug? This is indeed a bug in one of the most concurrent parts of |
It crashes in 100% cases, this is quite a complex code, with a few linked scopes when suspend function is passed as lambda to be called on another scope I can try to reproduce, but not sure that it would be easy |
That's really great, it would be drastically helpful for us if you could share it in any form, public or private. |
I just ran into this issues as well. It's reprducible, but only after x invocations of th property based testing. Here is the public repo, and a reference to the two failing tests: Hope this helps 👍 |
Thanks @nomisRev! I can verify it's reproducible. I'm not really familiar with kotest, does it require a special plugin? Because I can run tests from your project only as Gradle task, but cannot e.g. debug it from IDEA |
@nomisRev alas this bug has nothing to do with the original one, the reproducer is not using the piece of machinery that is prone to the actual bug. In your case things are much simpler -- when I would suspect the following function in your implementation:
You first resume the I suggest using |
Okay, I see. Thank you so much for the pointer @qwwdfsad! Changing it, and solved the problem! My apologies, I hoped I was able to help with a reproduceable example. I guess since I want to avoid the call to Can I ask you an unrelated question about Kotlin coroutines cancellation? documented here. |
Sure, you can reach me out in public Slack ( |
I'm also encountering this in my production app, but haven't been able to reproduce it, as it's happening in some bluetooth communication code that's hard to test at scale. Stacktrace
Having a look at previous issues #2719 and #2736 suggests that this could be caused by using inline suspend functions or inline classes, and both are used in the function where this is happening. I found this issue, that seems pretty similar to me. I can confirm that the reproducer in the comments still crashes on Kotlin 1.6.0 with coroutines 1.6.0-RC. |
I'm still experiencing this issue, I filled a bug and attached a small reproducer. Recently I tried updating the project to 1.6.10 with coroutines 1.6.0 and eap Ktor... still no luck |
@Xlopec thanks for writing here in addition to YT! I've reproduced your problem, it seems to be on the edge of |
I've found the root cause: https://youtrack.jetbrains.com/issue/KT-50832 As a workaround, please avoid method-references to |
any update for this? |
I do this code and has same problem in my android project,but I do the single test for the same code the error is gone,hope for a quick settlement.
|
any update?If cant resolve this issue,I have to put away the coroutines. |
I don't use ktor,but I have the same bug,If any update please reply,Thank you very much! |
Unfortunately, there are no updates apart from the ones in KT-50832: it will be fixed in 1.7.20, until then it's better to avoid a problematic pattern in your code base. Also, closing as compiler issue. |
So my issue is another?But how can I do can avoid? |
I have this crash on runtime with Kotlin 1.5.31 and kotlinx.coroutines 1.5.2. I use BOM for Kotlin and corouties with enforcePlatform, so it looks that correct version is used on runtime
It looks exactly the same as #2736 but this issue was closed and fix available in 1.5.2
So I report it separately.
The text was updated successfully, but these errors were encountered: