https://kotlinlang.org logo
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
benchmarks
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
confetti
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
lincheck
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by
Title
d

Didier Villevalois

09/12/2021, 9:26 AM
Hi everyone! I am facing a strange error while I run the
nativeTest
task in a multi-platform project (using coroutines
1.5.2-native-mt
). I use
runBlocking
around each of my tests. This works correctly when I run each test independently one by one. But when I run the whole test suite, at the start of the second test, I get
Uncaught Kotlin exception: kotlin.IllegalStateException: Cannot execute task because event loop was shut down
(full stack-trace in thread). Did anyone ever faced this?
The full stack-trace:
Uncaught Kotlin exception: kotlin.IllegalStateException: Cannot execute task because event loop was shut down
    at kfun:kotlin.Throwable#<init>(kotlin.String?){} (0x41da0b)
    at kfun:kotlin.Exception#<init>(kotlin.String?){} (0x417987)
    at kfun:kotlin.RuntimeException#<init>(kotlin.String?){} (0x417b07)
    at kfun:kotlin.IllegalStateException#<init>(kotlin.String?){} (0x417d77)
    at kfun:kotlinx.coroutines#loopWasShutDown(){}kotlin.Nothing (0x5de646)
    at kfun:kotlinx.coroutines.DefaultExecutor#enqueue(kotlinx.coroutines.Runnable){} (0x5de373)
    at kfun:kotlinx.coroutines.EventLoopImplBase#enqueue(kotlinx.coroutines.Runnable){} (0x561d26)
    at kfun:kotlinx.coroutines.EventLoopImplBase#dispatch(kotlin.coroutines.CoroutineContext;kotlinx.coroutines.Runnable){} (0x561c43)
    at kfun:kotlinx.coroutines.internal.DispatchedContinuation#resumeWith(kotlin.Result<1:0>){} (0x5b6f4e)
    at kfun:kotlinx.coroutines#resume__at__kotlinx.coroutines.CancellableContinuationImpl<0:0>(kotlin.coroutines.Continuation<0:0>;kotlin.Boolean){0§<kotlin.Any?>} (0x5ba30b)
    at kfun:kotlinx.coroutines.internal.shareableResume$lambda-1#internal (0x5ebebe)
    at kfun:kotlinx.coroutines.internal.$shareableResume$lambda-1$FUNCTION_REFERENCE$67.invoke#internal (0x5ec22d)
    at kfun:kotlinx.coroutines.internal.$shareableResume$lambda-1$FUNCTION_REFERENCE$67.$<bridge-UNN>invoke(){}#internal (0x5ec3bd)
    at WorkerLaunchpad (0x44994f)
    at _ZN6Worker19processQueueElementEb (0x80f4a4)
    at _ZN6Worker4parkElb (0x810add)
    at kfun:kotlin.native.concurrent.Worker#park(kotlin.Long;kotlin.Boolean){}kotlin.Boolean (0x44ce96)
    at kfun:kotlinx.coroutines.WorkerThread#parkNanos(kotlin.Long){} (0x5e2dc8)
    at kfun:kotlinx.coroutines#runEventLoop(kotlinx.coroutines.EventLoop?;kotlin.Function0<kotlin.Boolean>){} (0x5db635)
    at kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal (0x5dcabd)
    at kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 (0x5dc092)
    at kfun:org.zeromq.tests.utils#testSuspend(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,kotlin.Unit>){} (0x72a686)
    at kfun:org.zeromq.tests.utils#testSuspend$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,kotlin.Unit>;kotlin.Int){} (0x72a7ce)
    at kfun:org.zeromq.tests.utils#testWithEngine(org.zeromq.Engine;kotlin.coroutines.SuspendFunction1<org.zeromq.tests.utils.TestContextBuilder,kotlin.Unit>){} (0x725a23)
    at kfun:org.zeromq.tests.utils#contextTests(kotlin.collections.List<kotlin.String>;kotlin.coroutines.SuspendFunction1<org.zeromq.tests.utils.TestContextBuilder,kotlin.Unit>){} (0x724665)
    at kfun:org.zeromq.tests.utils#contextTests$default(kotlin.collections.List<kotlin.String>?;kotlin.coroutines.SuspendFunction1<org.zeromq.tests.utils.TestContextBuilder,kotlin.Unit>;kotlin.Int){} (0x724f3e)
    at kfun:org.zeromq.tests.sockets.PubSubTests#connectBindTest(){} (0x72aa3c)
    at kfun:org.zeromq.tests.sockets.$PubSubTests$test$0.$connectBindTest$FUNCTION_REFERENCE$1.invoke#internal (0x73b675)
    at kfun:org.zeromq.tests.sockets.$PubSubTests$test$0.$connectBindTest$FUNCTION_REFERENCE$1.$<bridge-UNNN>invoke(-1:0){}#internal (0x73b86b)
    at kfun:kotlin.native.internal.test.BaseClassSuite.TestCase#run(){} (0x472c5c)
    at kfun:kotlin.native.internal.test.TestRunner.run#internal (0x46a0bb)
    at kfun:kotlin.native.internal.test.TestRunner.runIteration#internal (0x46c8ba)
    at kfun:kotlin.native.internal.test.TestRunner#run(){}<http://kotlin.Int|kotlin.Int> (0x46da5b)
    at kfun:kotlin.native.internal.test#testLauncherEntryPoint(kotlin.Array<kotlin.String>){}<http://kotlin.Int|kotlin.Int> (0x45dece)
    at kfun:kotlin.native.internal.test#main(kotlin.Array<kotlin.String>){} (0x45dd89)
    at Konan_start (0x45dffd)
    at Init_and_run_start (0x7fd670)
    at __libc_start_main (0x7f2d36d57b75)
    at  (0x405d31)
    at  ((nil))
kotlinx.coroutines.CompletionHandlerException: Exception in completion handler ResumeOnCompletion@e08588[job@e0c3f8] for JobImpl{Cancelled}@e0c3f8
    at kfun:kotlin.Exception#<init>(kotlin.String?;kotlin.Throwable?){} (0x417a15)
    at kfun:kotlin.RuntimeException#<init>(kotlin.String?;kotlin.Throwable?){} (0x417b95)
    at kfun:kotlinx.coroutines.CompletionHandlerException#<init>(kotlin.String;kotlin.Throwable){} (0x5660d5)
    at kfun:kotlinx.coroutines.JobSupport.notifyCompletion#internal (0x56dc76)
    at kfun:kotlinx.coroutines.JobSupport.completeStateFinalization#internal (0x56c7b8)
    at kfun:kotlinx.coroutines.JobSupport.finalizeFinishingState#internal (0x56a401)
    at kfun:kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath#internal (0x576b91)
    at kfun:kotlinx.coroutines.JobSupport.tryMakeCompleting#internal (0x5762d3)
    at kfun:kotlinx.coroutines.JobSupport#makeCompleting(kotlin.Any?){}kotlin.Boolean (0x5759f4)
    at kfun:kotlinx.coroutines.JobImpl#completeExceptionally(kotlin.Throwable){}kotlin.Boolean (0x57f8ed)
    at kfun:io.ktor.utils.io.internal.AwaitingSlot#cancel(kotlin.Throwable?){} (0x67ee2a)
    at kfun:io.ktor.utils.io.ByteChannelSequentialBase#close(kotlin.Throwable?){}kotlin.Boolean (0x610159)
    at kfun:io.ktor.utils.io.ByteChannelNative#close(kotlin.Throwable?){}kotlin.Boolean (0x6844e5)
    at kfun:io.ktor.utils.io.ByteChannelSequentialBase#cancel(kotlin.Throwable?){}kotlin.Boolean (0x60fea4)
    at kfun:io.ktor.utils.io.$launchChannel$lambda-0COROUTINE$160.invokeSuspend#internal (0x619126)
    at kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} (0x43d0a0)
    at kfun:kotlinx.coroutines.internal.DispatchedContinuation#resumeWith(kotlin.Result<1:0>){} (0x5b7187)
    at kfun:kotlinx.coroutines#resume__at__kotlinx.coroutines.CancellableContinuationImpl<0:0>(kotlin.coroutines.Continuation<0:0>;kotlin.Boolean){0§<kotlin.Any?>} (0x5ba30b)
    at kfun:kotlinx.coroutines.internal.shareableResume$lambda-1#internal (0x5ebebe)
    at kfun:kotlinx.coroutines.internal.$shareableResume$lambda-1$FUNCTION_REFERENCE$67.invoke#internal (0x5ec22d)
    at kfun:kotlinx.coroutines.internal.$shareableResume$lambda-1$FUNCTION_REFERENCE$67.$<bridge-UNN>invoke(){}#internal (0x5ec3bd)
    at WorkerLaunchpad (0x44994f)
    at _ZN6Worker19processQueueElementEb (0x80f4a4)
    at _ZN6Worker4parkElb (0x810add)
    at kfun:kotlin.native.concurrent.Worker#park(kotlin.Long;kotlin.Boolean){}kotlin.Boolean (0x44ce96)
    at kfun:kotlinx.coroutines.WorkerThread#parkNanos(kotlin.Long){} (0x5e2dc8)
    at kfun:kotlinx.coroutines#runEventLoop(kotlinx.coroutines.EventLoop?;kotlin.Function0<kotlin.Boolean>){} (0x5db635)
    at kfun:kotlinx.coroutines.BlockingCoroutine.joinBlocking#internal (0x5dcabd)
    at kfun:kotlinx.coroutines#runBlocking(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,0:0>){0§<kotlin.Any?>}0:0 (0x5dc092)
    at kfun:org.zeromq.tests.utils#testSuspend(kotlin.coroutines.CoroutineContext;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,kotlin.Unit>){} (0x72a686)
    at kfun:org.zeromq.tests.utils#testSuspend$default(kotlin.coroutines.CoroutineContext?;kotlin.coroutines.SuspendFunction1<kotlinx.coroutines.CoroutineScope,kotlin.Unit>;kotlin.Int){} (0x72a7ce)
    at kfun:org.zeromq.tests.utils#testWithEngine(org.zeromq.Engine;kotlin.coroutines.SuspendFunction1<org.zeromq.tests.utils.TestContextBuilder,kotlin.Unit>){} (0x725a23)
    at kfun:org.zeromq.tests.utils#contextTests(kotlin.collections.List<kotlin.String>;kotlin.coroutines.SuspendFunction1<org.zeromq.tests.utils.TestContextBuilder,kotlin.Unit>){} (0x724665)
    at kfun:org.zeromq.tests.utils#contextTests$default(kotlin.collections.List<kotlin.String>?;kotlin.coroutines.SuspendFunction1<org.zeromq.tests.utils.TestContextBuilder,kotlin.Unit>;kotlin.Int){} (0x724f3e)
    at kfun:org.zeromq.tests.sockets.PubSubTests#connectBindTest(){} (0x72aa3c)
    at kfun:org.zeromq.tests.sockets.$PubSubTests$test$0.$connectBindTest$FUNCTION_REFERENCE$1.invoke#internal (0x73b675)
    at kfun:org.zeromq.tests.sockets.$PubSubTests$test$0.$connectBindTest$FUNCTION_REFERENCE$1.$<bridge-UNNN>invoke(-1:0){}#internal (0x73b86b)
    at kfun:kotlin.native.internal.test.BaseClassSuite.TestCase#run(){} (0x472c5c)
    at kfun:kotlin.native.internal.test.TestRunner.run#internal (0x46a0bb)
    at kfun:kotlin.native.internal.test.TestRunner.runIteration#internal (0x46c8ba)
    at kfun:kotlin.native.internal.test.TestRunner#run(){}<http://kotlin.Int|kotlin.Int> (0x46da5b)
    at kfun:kotlin.native.internal.test#testLauncherEntryPoint(kotlin.Array<kotlin.String>){}<http://kotlin.Int|kotlin.Int> (0x45dece)
    at kfun:kotlin.native.internal.test#main(kotlin.Array<kotlin.String>){} (0x45dd89)
    at Konan_start (0x45dffd)
    at Init_and_run_start (0x7fd670)
    at __libc_start_main (0x7f2d36d57b75)
    at  (0x405d31)
    at  ((nil))
Caused by: kotlin.IllegalStateException: Cannot execute task because event loop was shut down
    at kfun:kotlin.Throwable#<init>(kotlin.String?){} (0x41da0b)
    at kfun:kotlin.Exception#<init>(kotlin.String?){} (0x417987)
    at kfun:kotlin.RuntimeException#<init>(kotlin.String?){} (0x417b07)
    at kfun:kotlin.IllegalStateException#<init>(kotlin.String?){} (0x417d77)
    at kfun:kotlinx.coroutines#loopWasShutDown(){}kotlin.Nothing (0x5de646)
    at kfun:kotlinx.coroutines.DefaultExecutor#enqueue(kotlinx.coroutines.Runnable){} (0x5de373)
    at kfun:kotlinx.coroutines.EventLoopImplBase#enqueue(kotlinx.coroutines.Runnable){} (0x561d26)
    at kfun:kotlinx.coroutines.EventLoopImplBase#dispatch(kotlin.coroutines.CoroutineContext;kotlinx.coroutines.Runnable){} (0x561c43)
    at kfun:kotlinx.coroutines#dispatch__at__kotlinx.coroutines.CancellableContinuationImpl<0:0>(<http://kotlin.Int|kotlin.Int>){0§<kotlin.Any?>} (0x5b9892)
    at kfun:kotlinx.coroutines.CancellableContinuationImpl.dispatchResume#internal (0x554bcd)
    at kfun:kotlinx.coroutines.CancellableContinuationImpl.resumeImpl#internal (0x5554af)
    at kfun:kotlinx.coroutines.CancellableContinuationImpl#resumeImpl$default(kotlin.Any?;kotlin.Int;kotlin.Function1<kotlin.Throwable,kotlin.Unit>?;kotlin.Int){} (0x555782)
    at kfun:kotlinx.coroutines.CancellableContinuationImpl#resumeWith(kotlin.Result<1:0>){} (0x55396e)
    at kfun:kotlinx.coroutines.ResumeOnCompletion.invoke#internal (0x57e8b4)
    at kfun:kotlinx.coroutines.JobSupport.notifyCompletion#internal (0x56da9e)
    at kfun:kotlinx.coroutines.JobSupport.completeStateFinalization#internal (0x56c7b8)
    ... and 43 more common stack frames skipped
Uncaught Kotlin exception: kotlin.Throwable: The process was terminated due to the unhandled exception thrown in the coroutine [StandaloneCoroutine{Cancelling}@e07918, Dispatchers.Unconfined]: Exception in completion handler ResumeOnCompletion@e1b068[job@e06f58] for JobImpl{Cancelled}@e06f58
    at kfun:kotlinx.coroutines#handleCoroutineExceptionImpl(kotlin.coroutines.CoroutineContext;kotlin.Throwable){} (0x5deaad)
    at kfun:kotlinx.coroutines#handleCoroutineException(kotlin.coroutines.CoroutineContext;kotlin.Throwable){} (0x55c480)
    at kfun:kotlinx.coroutines.StandaloneCoroutine.handleJobException#internal (0x54d2a5)
    at kfun:kotlinx.coroutines.JobSupport.finalizeFinishingState#internal (0x56a6e8)
    at kfun:kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath#internal (0x576b91)
    at kfun:kotlinx.coroutines.JobSupport.tryMakeCompleting#internal (0x5762d3)
    at kfun:kotlinx.coroutines.JobSupport#makeCompletingOnce(kotlin.Any?){}kotlin.Any? (0x575d98)
    at kfun:kotlinx.coroutines.AbstractCoroutine#resumeWith(kotlin.Result<1:0>){} (0x54c454)
    at kfun:kotlin.coroutines.native.internal.BaseContinuationImpl#resumeWith(kotlin.Result<kotlin.Any?>){} (0x43d3b5)
[...]