question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to set custom timeout?

See original GitHub issue

Describe 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

  1. 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:closed
  • Created a year ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
AlexandreBrowncommented, Apr 19, 2022

@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

0reactions
github-actions[bot]commented, Apr 19, 2022

⚠️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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set custom timeout and retry | Cloud Spanner
Prepare the call settings with custom timeout and retry settings. CallSettings settings = CallSettings .FromExpiration(Expiration.FromTimeout(TimeSpan.
Read more >
How to set a custom timeout on http get nodeJS
How to set a custom timeout on http get nodeJS · paste the code where you are creating express object and starting the...
Read more >
Set Custom Timeout Property - vRealize Orchestrator
Click Add and wait for the vRealize Orchestrator server to restart. Results. The value you set overrides the default timeout setting of 20000 ......
Read more >
Specifying Custom Timeouts For Operations
Select the operation whose timeout you want to change (you can use SHIFT-click and CTRL-click for multi-selection). · Right-click the selected operation (or ......
Read more >
Maintain Custom Timeouts for Legacy Applications
Select · Select the protocol for the service to use (TCP or UDP). · Enter the destination port number or a range of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found