Skip to content

Instantly share code, notes, and snippets.

@madisp
Last active April 3, 2024 21:30
Show Gist options
  • Save madisp/c3c1e04ad0ef7c34ed66b5545606c846 to your computer and use it in GitHub Desktop.
Save madisp/c3c1e04ad0ef7c34ed66b5545606c846 to your computer and use it in GitHub Desktop.
package warp.io
import aws.sdk.kotlin.runtime.auth.credentials.StaticCredentialsProvider
import aws.sdk.kotlin.services.sqs.SqsClient
import aws.sdk.kotlin.services.sqs.model.CreateQueueRequest
import aws.sdk.kotlin.services.sqs.model.DeleteMessageRequest
import aws.sdk.kotlin.services.sqs.model.ReceiveMessageRequest
import aws.sdk.kotlin.services.sqs.model.SendMessageBatchRequest
import aws.sdk.kotlin.services.sqs.model.SendMessageBatchRequestEntry
import aws.smithy.kotlin.runtime.net.url.Url
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.take
import kotlinx.coroutines.flow.toCollection
import kotlinx.coroutines.test.runTest
import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import org.junit.Rule
import org.junit.Test
import org.testcontainers.containers.BindMode
import org.testcontainers.containers.localstack.LocalStackContainer
import org.testcontainers.utility.DockerImageName
import warpx.makeUuid
import kotlin.time.Duration.Companion.minutes
const val MESSAGES = 10
const val CONSUMERS = 10
class SqsKotlinLoadTest {
@get:Rule
val localstack = LocalStackContainer(DockerImageName.parse("localstack/localstack:3.1.0"))
.withFileSystemBind("infra/localstack", "/etc/localstack/init/ready.d", BindMode.READ_ONLY)
.withServices(LocalStackContainer.Service.S3, LocalStackContainer.Service.STS, LocalStackContainer.Service.IAM, LocalStackContainer.Service.SQS)
@Test
// @Ignore("Ignored, run manually only")
fun test() = runTest(timeout = 10.minutes) {
GlobalScope.async {
val sqsClient = SqsClient {
region = "eu-west-1"
endpointUrl = Url.parse(localstack.getEndpointOverride(LocalStackContainer.Service.SQS).toString())
credentialsProvider = StaticCredentialsProvider {
accessKeyId = "local"
secretAccessKey = "hunter2"
}
}
val q = sqsClient.createQueue(CreateQueueRequest {
queueName = "test-${makeUuid()}"
})
(0 until MESSAGES).chunked(10).map { chunk ->
sqsClient.sendMessageBatch(SendMessageBatchRequest {
queueUrl = q.queueUrl
entries = chunk.map {
SendMessageBatchRequestEntry {
id = it.toString()
messageBody = "test_$it"
}
}
})
println("Sent $chunk")
}
val consumers = (0 until CONSUMERS).map {
consume(it.toString(), sqsClient, q.queueUrl!!)
}
val received = mutableListOf<Recv>()
merge(*consumers.toTypedArray()).take(MESSAGES).onEach { println(it) }.toCollection(received)
println("Done")
received.groupBy { it.handler }.map { (k, v) ->
"${k.padStart(4, '0')}: ${v.size}"
}.sorted().forEach { println(it) }
sqsClient.close()
}.await()
}
suspend fun consume(id: String, client: SqsClient, queueUrl: String) = flow {
while (true) {
val messages = client.receiveMessage(ReceiveMessageRequest {
this.queueUrl = queueUrl
maxNumberOfMessages = 1
}).messages
messages?.forEach {
emit(Recv(it.body!!, id, Clock.System.now()))
client.deleteMessage(DeleteMessageRequest {
this.queueUrl = queueUrl
this.receiptHandle = it.receiptHandle!!
})
}
}
}
}
data class Recv(
val body: String,
val handler: String,
val ts: Instant,
)
kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCancelling@656ae223[job@bdebac4] for "coroutine#10":UndispatchedCoroutine{Cancelling}@bdebac4
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1477)
at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
at kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:748)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at kotlinx.coroutines.JobSupport.cancelCoroutine(JobSupport.kt:659)
at kotlinx.coroutines.channels.ChannelCoroutine.cancelInternal(ChannelCoroutine.kt:36)
at kotlinx.coroutines.channels.ChannelCoroutine.cancel(ChannelCoroutine.kt:30)
at kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt.cancelConsumed(Channels.common.kt:99)
at kotlinx.coroutines.channels.ChannelsKt.cancelConsumed(Unknown Source)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:39)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
at kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
Suppressed: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCancelling@60fd6a98[job@3438c74b] for "coroutine#11":UndispatchedCoroutine{Cancelling}@3438c74b
... 35 more
Caused by: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCompletion@61b64f8c[job@3013dd24] for JobImpl{Cancelled}@3013dd24
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1496)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:322)
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:239)
at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:907)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:864)
at kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:697)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:668)
at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:633)
at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:618)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:51)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:49)
at kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1428)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
... 34 more
Caused by: java.lang.IllegalStateException: Unbalanced enter/exit
at okio.AsyncTimeout.enter(AsyncTimeout.kt:58)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:384)
at okio.RealBufferedSource.read(RealBufferedSource.kt:193)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.kt:338)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.kt:375)
at okhttp3.internal._UtilJvmKt.skipAll(-UtilJvm.kt:143)
at okhttp3.internal._UtilJvmKt.discard(-UtilJvm.kt:164)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.close(Http1ExchangeCodec.kt:394)
at okio.ForwardingSource.close(ForwardingSource.kt:32)
at okhttp3.internal.connection.Exchange$ResponseBodySource.close(Exchange.kt:314)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at aws.smithy.kotlin.runtime.http.engine.okhttp.InstrumentedSource.close(MetricsInterceptor.kt:94)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at okhttp3.internal._UtilCommonKt.closeQuietly(-UtilCommon.kt:286)
at okhttp3.internal._ResponseBodyCommonKt.commonClose(-ResponseBodyCommon.kt:49)
at okhttp3.ResponseBody.close(ResponseBody.kt:77)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:54)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:53)
at kotlinx.coroutines.InvokeOnCompletion.invoke(JobSupport.kt:1382)
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1492)
... 46 more
Suppressed: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCancelling@6f7c3f9b[job@260d2872] for "coroutine#13":UndispatchedCoroutine{Cancelling}@260d2872
... 35 more
Caused by: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCompletion@4cd5073e[job@4d670b8b] for JobImpl{Cancelled}@4d670b8b
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1496)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:322)
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:239)
at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:907)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:864)
at kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:697)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:668)
at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:633)
at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:618)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:51)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:49)
at kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1428)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
... 34 more
Caused by: java.lang.IllegalStateException: Unbalanced enter/exit
at okio.AsyncTimeout.enter(AsyncTimeout.kt:58)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:384)
at okio.RealBufferedSource.read(RealBufferedSource.kt:193)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.kt:338)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.kt:375)
at okhttp3.internal._UtilJvmKt.skipAll(-UtilJvm.kt:143)
at okhttp3.internal._UtilJvmKt.discard(-UtilJvm.kt:164)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.close(Http1ExchangeCodec.kt:394)
at okio.ForwardingSource.close(ForwardingSource.kt:32)
at okhttp3.internal.connection.Exchange$ResponseBodySource.close(Exchange.kt:314)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at aws.smithy.kotlin.runtime.http.engine.okhttp.InstrumentedSource.close(MetricsInterceptor.kt:94)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at okhttp3.internal._UtilCommonKt.closeQuietly(-UtilCommon.kt:286)
at okhttp3.internal._ResponseBodyCommonKt.commonClose(-ResponseBodyCommon.kt:49)
at okhttp3.ResponseBody.close(ResponseBody.kt:77)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:54)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:53)
at kotlinx.coroutines.InvokeOnCompletion.invoke(JobSupport.kt:1382)
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1492)
... 46 more
Suppressed: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCancelling@39453677[job@7644c795] for "coroutine#16":UndispatchedCoroutine{Cancelling}@7644c795
... 35 more
Caused by: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCompletion@4285377a[job@37cb57f2] for JobImpl{Cancelled}@37cb57f2
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1496)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:322)
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:239)
at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:907)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:864)
at kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:697)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:668)
at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:633)
at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:618)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:51)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:49)
at kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1428)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
... 34 more
Caused by: java.lang.IllegalStateException: Unbalanced enter/exit
at okio.AsyncTimeout.enter(AsyncTimeout.kt:58)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:384)
at okio.RealBufferedSource.read(RealBufferedSource.kt:193)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.kt:338)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.kt:375)
at okhttp3.internal._UtilJvmKt.skipAll(-UtilJvm.kt:143)
at okhttp3.internal._UtilJvmKt.discard(-UtilJvm.kt:164)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.close(Http1ExchangeCodec.kt:394)
at okio.ForwardingSource.close(ForwardingSource.kt:32)
at okhttp3.internal.connection.Exchange$ResponseBodySource.close(Exchange.kt:314)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at aws.smithy.kotlin.runtime.http.engine.okhttp.InstrumentedSource.close(MetricsInterceptor.kt:94)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at okhttp3.internal._UtilCommonKt.closeQuietly(-UtilCommon.kt:286)
at okhttp3.internal._ResponseBodyCommonKt.commonClose(-ResponseBodyCommon.kt:49)
at okhttp3.ResponseBody.close(ResponseBody.kt:77)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:54)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:53)
at kotlinx.coroutines.InvokeOnCompletion.invoke(JobSupport.kt:1382)
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1492)
... 46 more
Caused by: kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCompletion@1e87550c[job@4e63952f] for JobImpl{Cancelled}@4e63952f
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1496)
at kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:322)
at kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:239)
at kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:907)
at kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:864)
at kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:697)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:668)
at kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:633)
at kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:618)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:51)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:49)
at kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1428)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
... 34 more
Caused by: java.lang.IllegalStateException: Unbalanced enter/exit
at okio.AsyncTimeout.enter(AsyncTimeout.kt:58)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:384)
at okio.RealBufferedSource.read(RealBufferedSource.kt:193)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.kt:338)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.kt:375)
at okhttp3.internal._UtilJvmKt.skipAll(-UtilJvm.kt:143)
at okhttp3.internal._UtilJvmKt.discard(-UtilJvm.kt:164)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.close(Http1ExchangeCodec.kt:394)
at okio.ForwardingSource.close(ForwardingSource.kt:32)
at okhttp3.internal.connection.Exchange$ResponseBodySource.close(Exchange.kt:314)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at aws.smithy.kotlin.runtime.http.engine.okhttp.InstrumentedSource.close(MetricsInterceptor.kt:94)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at okhttp3.internal._UtilCommonKt.closeQuietly(-UtilCommon.kt:286)
at okhttp3.internal._ResponseBodyCommonKt.commonClose(-ResponseBodyCommon.kt:49)
at okhttp3.ResponseBody.close(ResponseBody.kt:77)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:54)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:53)
at kotlinx.coroutines.InvokeOnCompletion.invoke(JobSupport.kt:1382)
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1492)
... 46 more
Exception in completion handler InvokeOnCompletion@1e87550c[job@4e63952f] for JobImpl{Cancelled}@4e63952f
kotlinx.coroutines.CompletionHandlerException: Exception in completion handler InvokeOnCompletion@1e87550c[job@4e63952f] for JobImpl{Cancelled}@4e63952f
at app//kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1496)
at app//kotlinx.coroutines.JobSupport.completeStateFinalization(JobSupport.kt:322)
at app//kotlinx.coroutines.JobSupport.finalizeFinishingState(JobSupport.kt:239)
at app//kotlinx.coroutines.JobSupport.tryMakeCompletingSlowPath(JobSupport.kt:907)
at app//kotlinx.coroutines.JobSupport.tryMakeCompleting(JobSupport.kt:864)
at app//kotlinx.coroutines.JobSupport.cancelMakeCompleting(JobSupport.kt:697)
at app//kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:668)
at app//kotlinx.coroutines.JobSupport.cancelInternal(JobSupport.kt:633)
at app//kotlinx.coroutines.JobSupport.cancel(JobSupport.kt:618)
at app//aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:51)
at app//aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:49)
at app//kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1428)
at app//kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at app//kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
at app//kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
at app//kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at app//kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
at app//kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
at app//kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at app//kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
at app//kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
at app//kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at app//kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
at app//kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
at app//kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at app//kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:796)
at app//kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:756)
at app//kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at app//kotlinx.coroutines.JobSupport.parentCancelled(JobSupport.kt:638)
at app//kotlinx.coroutines.ChildHandleNode.invoke(JobSupport.kt:1436)
at app//kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1473)
at app//kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:748)
at app//kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:672)
at app//kotlinx.coroutines.JobSupport.cancelCoroutine(JobSupport.kt:659)
at app//kotlinx.coroutines.channels.ChannelCoroutine.cancelInternal(ChannelCoroutine.kt:36)
at app//kotlinx.coroutines.channels.ChannelCoroutine.cancel(ChannelCoroutine.kt:30)
at app//kotlinx.coroutines.channels.ChannelsKt__Channels_commonKt.cancelConsumed(Channels.common.kt:99)
at app//kotlinx.coroutines.channels.ChannelsKt.cancelConsumed(Unknown Source)
at app//kotlinx.coroutines.flow.FlowKt__ChannelsKt.emitAllImpl$FlowKt__ChannelsKt(Channels.kt:39)
at app//kotlinx.coroutines.flow.FlowKt__ChannelsKt.access$emitAllImpl$FlowKt__ChannelsKt(Channels.kt:1)
at app//kotlinx.coroutines.flow.FlowKt__ChannelsKt$emitAllImpl$1.invokeSuspend(Channels.kt)
at app//kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at app//kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
at app//kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:585)
at app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:802)
at app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:706)
at app//kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:693)
Caused by: java.lang.IllegalStateException: Unbalanced enter/exit
at okio.AsyncTimeout.enter(AsyncTimeout.kt:58)
at okio.AsyncTimeout$source$1.read(AsyncTimeout.kt:384)
at okio.RealBufferedSource.read(RealBufferedSource.kt:193)
at okhttp3.internal.http1.Http1ExchangeCodec$AbstractSource.read(Http1ExchangeCodec.kt:338)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.read(Http1ExchangeCodec.kt:375)
at okhttp3.internal._UtilJvmKt.skipAll(-UtilJvm.kt:143)
at okhttp3.internal._UtilJvmKt.discard(-UtilJvm.kt:164)
at okhttp3.internal.http1.Http1ExchangeCodec$FixedLengthSource.close(Http1ExchangeCodec.kt:394)
at okio.ForwardingSource.close(ForwardingSource.kt:32)
at okhttp3.internal.connection.Exchange$ResponseBodySource.close(Exchange.kt:314)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at aws.smithy.kotlin.runtime.http.engine.okhttp.InstrumentedSource.close(MetricsInterceptor.kt:94)
at okio.RealBufferedSource.close(RealBufferedSource.kt:484)
at okhttp3.internal._UtilCommonKt.closeQuietly(-UtilCommon.kt:286)
at okhttp3.internal._ResponseBodyCommonKt.commonClose(-ResponseBodyCommon.kt:49)
at okhttp3.ResponseBody.close(ResponseBody.kt:77)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:54)
at aws.smithy.kotlin.runtime.http.engine.okhttp.OkHttpEngine$roundTrip$2.invoke(OkHttpEngine.kt:53)
at kotlinx.coroutines.InvokeOnCompletion.invoke(JobSupport.kt:1382)
at kotlinx.coroutines.JobSupport.notifyCompletion(JobSupport.kt:1492)
... 46 more
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment