How to set custom timeout?
See original GitHub issueDescribe the issue
For highly concurrent environment, we get timeout errors.
13:56:49.493 [DefaultDispatcher-worker-25] ERROR aws.smithy.kotlin.runtime.http.engine.ktor.KtorEngine - throwing
java.util.concurrent.CancellationException: Timed out waiting for 20000 ms
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:39)
at aws.smithy.kotlin.runtime.http.engine.CoroutineUtilsKt$attachToOuterJob$cleanupHandler$1.invoke(CoroutineUtils.kt:37)
at kotlinx.coroutines.InvokeOnCancelling.invoke(JobSupport.kt:1457)
at kotlinx.coroutines.JobSupport.notifyCancelling(JobSupport.kt:1499)
at kotlinx.coroutines.JobSupport.tryMakeCancelling(JobSupport.kt:795)
at kotlinx.coroutines.JobSupport.makeCancelling(JobSupport.kt:755)
at kotlinx.coroutines.JobSupport.cancelImpl$kotlinx_coroutines_core(JobSupport.kt:671)
at kotlinx.coroutines.JobSupport.cancelCoroutine(JobSupport.kt:658)
at kotlinx.coroutines.TimeoutCoroutine.run(Timeout.kt:154)
at kotlinx.coroutines.EventLoopImplBase$DelayedRunnableTask.run(EventLoop.common.kt:502)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279)
at kotlinx.coroutines.DefaultExecutor.run(DefaultExecutor.kt:108)
at java.base/java.lang.Thread.run(Thread.java:829)
If we reduce the concurrency level then we don’t get the error because the coroutine is able to get some breathing time faster.
We’d like to know how could we tweak the request timeout like we can do for Ktor Http client?
HttpClient(CIO) {
install(JsonFeature)
install(HttpTimeout) {
requestTimeoutMillis = 1.0.hours.inWholeMilliseconds
}
}
Is there a way to set the client to our Ktor Http Client without having to implement any behaviour (like closing a connection etc)? Or is there simply a way to set the requestTimeoutMillis
for aws kotlin sdk?
I thought that the timeout was removed after https://github.com/awslabs/aws-sdk-kotlin/issues/572 was resolved, but we still get the issue even after upgrading to 0.14.2-beta
. Perhaps the timeout on aws side was removed but there is still a default timeout in the underlying KtorEngine that the aws sdk uses.
Steps to Reproduce
- Create a put request in a highly concurrent environment
Current behavior
13:27:15.343 [DefaultDispatcher-worker-25] ERROR aws.smithy.kotlin.runtime.http.engine.ktor.KtorEngine - throwing
java.util.concurrent.CancellationException: Timed out waiting for 20000 ms
AWS Kotlin SDK version used
0.14.2-beta
Platform (JVM/JS/Native)
JVM
Operating System and version
Ubuntu 20.04.3 LTS
Issue Analytics
- State:
- Created a year ago
- Comments:10 (1 by maintainers)
Top GitHub Comments
@aajtodd @ianbotsf Hi, we made changes to the code so that it is highly concurrent again and tried to reproduce and now we’re unable to reproduce.
Perhaps the gradle build was using a cached version of kotlin sdk instead of the updated
0.14.2-beta
?We will close this issue and re-open if we can reproduce.
Thanks
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.