softwaremill / sttp

The Scala HTTP client you always wanted!
https://sttp.softwaremill.com
Apache License 2.0
1.45k stars 309 forks source link

Akka HTTP backend does not honour readTimeout #278

Closed TJC closed 5 years ago

TJC commented 5 years ago

I'm fairly sure the sttp readTimeout is not honoured by the akka http backend.

Try creating an HTTP server which accepts a request and then sleeps for five minutes.

Now use sttp to query it, with a 1 second read timeout -- And time how long it takes to go from making the request, to getting the failure message.

adamw commented 5 years ago

Are you doing GET requests to test? akka-http by default retries idempotent requests, so maybe the timeout is working fine, but it's getting retried a couple of times, see: https://doc.akka.io/docs/akka-http/current/client-side/host-level.html#retrying-a-request

You can try setting akka.http.host-connection-pool.max-retries = 0 to disable this

TJC commented 5 years ago

Thanks Adam -- after some investigation that auto-retry turned out to be the cause.