Skip to content

Commit

Permalink
Set default ReadTimeout value to 60s
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Pollet <[email protected]>
  • Loading branch information
rtribotte and kevinpollet authored Apr 11, 2024
1 parent 584839e commit 240b83b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
5 changes: 1 addition & 4 deletions docs/content/migration/v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ To configure responding timeouts

### EntryPoint.Transport.RespondingTimeouts.ReadTimeout

Starting with `v2.11.2` the entryPoints `readTimeout` option default value changed to 5 seconds.
Starting with `v2.11.2` the entryPoints [`readTimeout`](../routing/entrypoints.md#respondingtimeouts) option default value changed to 60 seconds.

For HTTP, this option defines the maximum duration for reading the entire request, including the body.
For TCP, this option defines the maximum duration for the first bytes to be read on the connection.
Expand All @@ -632,9 +632,6 @@ The default value was previously set to zero, which means no timeout.

This change has been done to avoid Traefik instances with the default configuration to be hanging forever while waiting for bytes to be read on the connection.

We suggest to adapt this value accordingly to your situation, as the new default value is purposely narrowed,
it can make the connection be closed too early.

Increasing the `readTimeout` value could be the solution notably if you are dealing with the following errors:

- TCP: `Error while handling TCP connection: readfrom tcp X.X.X.X:X->X.X.X.X:X: read tcp X.X.X.X:X->X.X.X.X:X: i/o timeout`
Expand Down
2 changes: 1 addition & 1 deletion docs/content/reference/static-configuration/cli-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Duration to keep accepting requests before Traefik initiates the graceful shutdo
IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set. (Default: ```180```)

`--entrypoints.<name>.transport.respondingtimeouts.readtimeout`:
ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```5```)
ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```60```)

`--entrypoints.<name>.transport.respondingtimeouts.writetimeout`:
WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set. (Default: ```0```)
Expand Down
2 changes: 1 addition & 1 deletion docs/content/reference/static-configuration/env-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Duration to keep accepting requests before Traefik initiates the graceful shutdo
IdleTimeout is the maximum amount duration an idle (keep-alive) connection will remain idle before closing itself. If zero, no timeout is set. (Default: ```180```)

`TRAEFIK_ENTRYPOINTS_<NAME>_TRANSPORT_RESPONDINGTIMEOUTS_READTIMEOUT`:
ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```5```)
ReadTimeout is the maximum duration for reading the entire request, including the body. If zero, no timeout is set. (Default: ```60```)

`TRAEFIK_ENTRYPOINTS_<NAME>_TRANSPORT_RESPONDINGTIMEOUTS_WRITETIMEOUT`:
WriteTimeout is the maximum duration before timing out writes of the response. If zero, no timeout is set. (Default: ```0```)
Expand Down
4 changes: 2 additions & 2 deletions docs/content/routing/entrypoints.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,14 +402,14 @@ Setting them has no effect for UDP entryPoints.

??? info "`transport.respondingTimeouts.readTimeout`"

_Optional, Default=5s_
_Optional, Default=60s_

`readTimeout` is the maximum duration for reading the entire request, including the body.

If zero, no timeout exists.
Can be provided in a format supported by [time.ParseDuration](https://golang.org/pkg/time/#ParseDuration) or as raw values (digits).
If no units are provided, the value is parsed assuming seconds.
For requests with large payloads, this timeout value might be increased.
We strongly suggest to adapt this value accordingly to the your needs.

```yaml tab="File (YAML)"
## Static configuration
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/static/static_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const (
DefaultIdleTimeout = 180 * time.Second

// DefaultReadTimeout defines the default maximum duration for reading the entire request, including the body.
DefaultReadTimeout = 5 * time.Second
DefaultReadTimeout = 60 * time.Second

// DefaultAcmeCAServer is the default ACME API endpoint.
DefaultAcmeCAServer = "https://acme-v02.api.letsencrypt.org/directory"
Expand Down

0 comments on commit 240b83b

Please sign in to comment.