Skip to content

TimeoutBroadcastTxCommit should overwrite the WriteTimeout limit #3435

@ebuchman

Description

@ebuchman

Go servers only allow you to set a global WriteTimeout on the server, where the WriteTimeout starts after the request header is read, so it sets an absolute lifetime for the request.

It would be nicer if it started instead when we started writing the response, but now it can't be changed because Go v1 compatibility (see golang/go#24461).

Worse, you can't set the WriteTimeout on a per request basis, only globally, since there's no way to access the underlying connection. There is some discussion in golang/go#16100 but it's unclear if/when that will land.

This means the timeout for broadcast tx commit MUST be smaller than the configured WriteTimeout. This is currently hard coded at 20s. While the TimeoutBroadcastTxCommit is exposed in the config as of #3269, the WriteTimeout is not. We also throw an error if TimeoutBroadcastTxCommit > WriteTimeout. Instead, for now, we should just set WriteTimeout = TimeoutBroadcastTxCommit + delta so users can set the TimeoutBroadcastTxCommit as high as necessary, and the rpc WriteTimeout will just be equally as high, and we'll clearly document what's happening.

It's a bit silly to increase the global WriteTimeout just because you want a higher timeout for one endpoint (broadcast tx commit), but there isn't really a better alternative for now. Once golang/go#16100 is implemented, then timeout_broadcast_tx_commit can be independent of WriteTimeout, and as large as the user wants.

Metadata

Metadata

Assignees

Labels

C:rpcComponent: JSON RPC, gRPCT:bugType Bug (Confirmed)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions