-
Notifications
You must be signed in to change notification settings - Fork 1.9k
ChannelAtomicCancelStressTest fails with CoroutinesInternalError caused by ClassCastException #1588
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
https://teamcity.jetbrains.com/viewLog.html?buildId=2555599&buildTypeId=KotlinTools_KotlinxCoroutines_BuildWindows
|
https://teamcity.jetbrains.com/viewLog.html?buildId=2556063&tab=buildResultsDiv&buildTypeId=KotlinTools_KotlinxCoroutines_Build#testNameId-3299188611556527194
|
https://teamcity.jetbrains.com/viewLog.html?buildId=2565287&tab=buildResultsDiv&buildTypeId=KotlinTools_KotlinxCoroutines_BuildWindows
|
https://teamcity.jetbrains.com/viewLog.html?buildId=2566584&tab=buildResultsDiv&buildTypeId=KotlinTools_KotlinxCoroutines_Build#testNameId-3299188611556527194
|
https://teamcity.jetbrains.com/viewLog.html?buildId=2567101&tab=buildResultsDiv&buildTypeId=KotlinTools_KotlinxCoroutines_NightlyStress#testNameId-3299188611556527194
|
This bug was introduced by PR #1524. It was reproducing when there is a regular "send" operation on one side of a channel and "select { onReceive }" on another side of the channel and the "send" coroutine gets cancelled. The problem is that SendElement.tryResumeSend implementation was calling finishPrepare before it has successfully resumed continuation, so if that continuation was already cancelled, the code in "finishPrepare" had already stored the wrong affected node which it would later try to call "completeResume" on. This patch also adds hexAddress to the debug toString method of all internal node classes in channel implementation. Fixes #1588
This bug was introduced by PR #1524. It was reproducing when there is a regular "send" operation on one side of a channel and "select { onReceive }" on another side of the channel and the "send" coroutine gets cancelled. The problem is that SendElement.tryResumeSend implementation was calling finishPrepare before it has successfully resumed continuation, so if that continuation was already cancelled, the code in "finishPrepare" had already stored the wrong affected node which it would later try to call "completeResume" on. This patch also adds hexAddress to the debug toString method of all internal node classes in channel implementation. Fixes #1588
This bug was introduced by PR #1524. It was reproducing when there is a regular "send" operation on one side of a channel and "select { onReceive }" on another side of the channel and the "send" coroutine gets cancelled. The problem is that SendElement.tryResumeSend implementation was calling finishPrepare before it has successfully resumed continuation, so if that continuation was already cancelled, the code in "finishPrepare" had already stored the wrong affected node which it would later try to call "completeResume" on. This patch also adds hexAddress to the debug toString method of all internal node classes in channel implementation. Fixes #1588
Fixed in develop, was reproducible only in develop |
The above crash log is reproducible in kotlinx.coroutines version 1.3.3 and 1.3.4 |
@debaj Can you elaborate? What environment was the code running in? |
@elizarov It happens when the code, running inside coroutine, finishes. The coroutine was called from Java class like that: |
@elizarov I am able to reproduce this on coroutines version 1.3.5. fun main() {
runBlocking {
val f = flow<Int> {
repeat(10){
println("Emmiting $it")
emit(it)
}
}
launch {
f.collect {
delay(4000)
println(it)
}
}
}
} Running the above code gives same excepton. |
How reliably it reproduces on your machine? Can you give more details on your setup, please: OS, CPU, Kotlin version, JDK version? |
Hi @elizarov I think I get this error because I am using I just tried on Idea 2019 with Kotin version 1.3.61 with coroutines 1.3.5 and it worked as expected. |
Recent versions of coroutines are not compatible with older versions of Kotlin. |
https://teamcity.jetbrains.com/viewLog.html?buildId=2565122&buildTypeId=KotlinTools_KotlinxCoroutines_BuildWindows
ChannelAtomicCancelStressTest.testAtomicCancelStress[RendezvousChannel]
The text was updated successfully, but these errors were encountered: