From 5b255119b7773039598697b942396159ea041122 Mon Sep 17 00:00:00 2001 From: Andrey Butusov Date: Mon, 7 Oct 2024 15:35:34 +0300 Subject: [PATCH] node, ir: set default dial timeout to 1 minute Set default timeout for dialing connections in node: - `morph.dial_timeout` - `apiclient.dial_timout` - `apiclient.stream_timeout` and in inner ring: - `morph.dial_timout` - `morph.consensus.p2p.dial_timout` - `mainnet.dial_timout` to 1 minute. Update example configs and docs. Closes #2891. Signed-off-by: Andrey Butusov --- CHANGELOG.md | 1 + cmd/neofs-ir/defaults.go | 4 ++-- cmd/neofs-node/config/apiclient/config.go | 4 ++-- cmd/neofs-node/config/morph/config.go | 2 +- config/example/ir.env | 4 ++-- config/example/ir.yaml | 6 +++--- config/example/node.yaml | 6 +++--- config/mainnet/config.yml | 2 +- config/testnet/config.yml | 2 +- docs/storage-node-configuration.md | 4 ++-- pkg/innerring/internal/blockchain/blockchain.go | 4 ++-- 11 files changed, 20 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b96dc289f7..853f177341 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ attribute, which is used for container domain name in NNS contracts (#2954) - Metabase graveyard scheme (#2929) - When an error is returned, no additional help output is displayed in cobra-based programs (#2942) - Use org-wide linter (#2943) +- Default dial timeout to one minute (#2963) ### Removed - Support for node.key configuration (#2959) diff --git a/cmd/neofs-ir/defaults.go b/cmd/neofs-ir/defaults.go index 86e78c5b5c..41905a5f7d 100644 --- a/cmd/neofs-ir/defaults.go +++ b/cmd/neofs-ir/defaults.go @@ -47,12 +47,12 @@ func defaultConfiguration(cfg *viper.Viper) { cfg.SetDefault("node.persistent_state.path", ".neofs-ir-state") - cfg.SetDefault("morph.dial_timeout", 15*time.Second) + cfg.SetDefault("morph.dial_timeout", time.Minute) cfg.SetDefault("morph.reconnections_number", 5) cfg.SetDefault("morph.reconnections_delay", 5*time.Second) cfg.SetDefault("morph.validators", []string{}) - cfg.SetDefault("mainnet.dial_timeout", 15*time.Second) + cfg.SetDefault("mainnet.dial_timeout", time.Minute) cfg.SetDefault("mainnet.reconnections_number", 5) cfg.SetDefault("mainnet.reconnections_delay", 5*time.Second) diff --git a/cmd/neofs-node/config/apiclient/config.go b/cmd/neofs-node/config/apiclient/config.go index b6f59d4878..393f09ceb3 100644 --- a/cmd/neofs-node/config/apiclient/config.go +++ b/cmd/neofs-node/config/apiclient/config.go @@ -10,10 +10,10 @@ const ( subsection = "apiclient" // DialTimeoutDefault is a default dial timeout of NeoFS API client connection. - DialTimeoutDefault = 5 * time.Second + DialTimeoutDefault = time.Minute // StreamTimeoutDefault is a default timeout of NeoFS API streaming operation. - StreamTimeoutDefault = 15 * time.Second + StreamTimeoutDefault = time.Minute ) // DialTimeout returns the value of "dial_timeout" config parameter diff --git a/cmd/neofs-node/config/morph/config.go b/cmd/neofs-node/config/morph/config.go index 1c5727870a..8d7699fbfa 100644 --- a/cmd/neofs-node/config/morph/config.go +++ b/cmd/neofs-node/config/morph/config.go @@ -11,7 +11,7 @@ const ( subsection = "morph" // DialTimeoutDefault is a default dial timeout of morph chain client connection. - DialTimeoutDefault = 5 * time.Second + DialTimeoutDefault = time.Minute // CacheTTLDefault is a default value for cached values TTL. // It is 0, because actual default depends on block time. diff --git a/config/example/ir.env b/config/example/ir.env index de5b46f139..f234b823d2 100644 --- a/config/example/ir.env +++ b/config/example/ir.env @@ -6,13 +6,13 @@ NEOFS_IR_WALLET_PASSWORD=secret NEOFS_IR_WITHOUT_MAINNET=false -NEOFS_IR_MORPH_DIAL_TIMEOUT=5s +NEOFS_IR_MORPH_DIAL_TIMEOUT=1m NEOFS_IR_MORPH_RECONNECTIONS_NUMBER=5 NEOFS_IR_MORPH_RECONNECTIONS_DELAY=5s NEOFS_IR_MORPH_ENDPOINTS="wss://sidechain1.fs.neo.org:30333/ws wss://sidechain2.fs.neo.org:30333/ws" NEOFS_IR_MORPH_VALIDATORS="0283120f4c8c1fc1d792af5063d2def9da5fddc90bc1384de7fcfdda33c3860170" -NEOFS_IR_MAINNET_DIAL_TIMEOUT=5s +NEOFS_IR_MAINNET_DIAL_TIMEOUT=1m NEOFS_IR_MAINNET_RECONNECTIONS_NUMBER=5 NEOFS_IR_MAINNET_RECONNECTIONS_DELAY=5s NEOFS_IR_MAINNET_ENDPOINTS="wss://mainchain1.fs.neo.org:30333/ws wss://mainchain2.fs.neo.org:30333/ws" diff --git a/config/example/ir.yaml b/config/example/ir.yaml index e00c39007b..91df95b4c6 100644 --- a/config/example/ir.yaml +++ b/config/example/ir.yaml @@ -11,7 +11,7 @@ wallet: without_mainnet: false # Run application in single chain environment without mainchain morph: - dial_timeout: 5s # Timeout for RPC client connection to sidechain + dial_timeout: 1m # Timeout for RPC client connection to sidechain reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts endpoints: # List of websocket RPC endpoints in sidechain. May be omitted if 'consensus' is configured @@ -65,7 +65,7 @@ morph: cert_file: serv.crt # TLS certificate file path; required if 'enabled' is 'true' key_file: serv.key # TLS private key file path; required if 'enabled' is 'true' p2p: # Optional P2P settings - dial_timeout: 5s # Optional maximum duration a single peer dial may take. Defaults to 5s. Must not be negative + dial_timeout: 1m # Optional maximum duration a single peer dial may take. Defaults to 1m. Must not be negative proto_tick_interval: 2s # Optional time period between protocol ticks with each connected peer. Defaults to 2s. # Must not be negative listen: # Optional list of network addresses to listen Neo P2P on. By default, protocol is not served @@ -96,7 +96,7 @@ nns: # Optional configuration of the NNS domains processed during the FS chain d # Defaults to 'nonexistent@nspcc.io' mainnet: - dial_timeout: 5s # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled + dial_timeout: 1m # Timeout for RPC client connection to mainchain; ignore if mainchain is disabled reconnections_number: 5 # number of reconnection attempts reconnections_delay: 5s # time delay b/w reconnection attempts endpoints: # List of websocket RPC endpoints in mainchain; ignore if mainchain is disabled diff --git a/config/example/node.yaml b/config/example/node.yaml index 9b794820a5..679e4d0454 100644 --- a/config/example/node.yaml +++ b/config/example/node.yaml @@ -70,7 +70,7 @@ contracts: # side chain NEOFS contract script hashes; optional, override values proxy: ad7c6b55b737b696e5c82c85445040964a03e97f morph: - dial_timeout: 30s # timeout for side chain NEO RPC client connection + dial_timeout: 30s # timeout for side chain NEO RPC client connection (default: 1m) cache_ttl: 15s # Sidechain cache TTL value (min interval between similar calls). Negative value disables caching. # Default value: block time. It is recommended to have this value less or equal to block time. # Cached entities: containers, container lists, eACL tables. @@ -81,8 +81,8 @@ morph: - wss://rpc2.morph.fs.neo.org:40341/ws apiclient: - dial_timeout: 15s # timeout for NEOFS API client connection - stream_timeout: 20s # timeout for individual operations in a streaming RPC + dial_timeout: 15s # timeout for NEOFS API client connection (default: 1m) + stream_timeout: 20s # timeout for individual operations in a streaming RPC (default: 1m) allow_external: true # allow to fallback to addresses in `ExternalAddr` attribute reconnect_timeout: 30s # time to wait before reconnecting to a failed node diff --git a/config/mainnet/config.yml b/config/mainnet/config.yml index f2fdff5202..d33570c4d4 100644 --- a/config/mainnet/config.yml +++ b/config/mainnet/config.yml @@ -59,7 +59,7 @@ morph: - wss://rpc5.morph.fs.neo.org:40341/ws - wss://rpc6.morph.fs.neo.org:40341/ws - wss://rpc7.morph.fs.neo.org:40341/ws - dial_timeout: 20s + dial_timeout: 1m contracts: balance: dc1ec98d9d0c5f9dfade16144defe08cffc5ca55 diff --git a/config/testnet/config.yml b/config/testnet/config.yml index 6372d059c1..51b59b3fa6 100644 --- a/config/testnet/config.yml +++ b/config/testnet/config.yml @@ -10,7 +10,7 @@ morph: - wss://rpc05.morph.testnet.fs.neo.org:51331/ws - wss://rpc06.morph.testnet.fs.neo.org:51331/ws - wss://rpc07.morph.testnet.fs.neo.org:51331/ws - dial_timeout: 20s + dial_timeout: 1m contracts: balance: e0420c216003747626670d1424569c17c79015bf diff --git a/docs/storage-node-configuration.md b/docs/storage-node-configuration.md index fb191c8b3c..364ef851d3 100644 --- a/docs/storage-node-configuration.md +++ b/docs/storage-node-configuration.md @@ -137,7 +137,7 @@ morph: | Parameter | Type | Default value | Description | |------------------------|------------|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `dial_timeout` | `duration` | `5s` | Timeout for dialing connections to N3 RPCs. | +| `dial_timeout` | `duration` | `1m` | Timeout for dialing connections to N3 RPCs. | | `cache_ttl` | `duration` | Morph block time | Sidechain cache TTL value (min interval between similar calls).
Negative value disables caching.
Cached entities: containers, container lists, eACL tables. | | `endpoints` | `[]string` | | Ordered array of _webSocket_ N3 endpoint. Only one is connected at a time, the others are for a fallback if any network error appears. | | `reconnections_number` | `int` | `5` | Number of reconnection attempts (through the full list provided via `endpoints`) before RPC connection is considered lost. Non-positive values make no retries. | @@ -333,7 +333,7 @@ apiclient: ``` | Parameter | Type | Default value | Description | |-------------------|----------|---------------|-----------------------------------------------------------------------| -| dial_timeout | duration | `5s` | Timeout for dialing connections to other storage or inner ring nodes. | +| dial_timeout | duration | `1m` | Timeout for dialing connections to other storage or inner ring nodes. | | stream_timeout | duration | `15s` | Timeout for individual operations in a streaming RPC. | | reconnect_timeout | duration | `30s` | Time to wait before reconnecting to a failed node. | diff --git a/pkg/innerring/internal/blockchain/blockchain.go b/pkg/innerring/internal/blockchain/blockchain.go index 082fc46f5a..d8c5193e81 100644 --- a/pkg/innerring/internal/blockchain/blockchain.go +++ b/pkg/innerring/internal/blockchain/blockchain.go @@ -147,7 +147,7 @@ type P2PConfig struct { // Maximum duration a single dial may take. // - // Optional: defaults to 5s. Must not be negative. + // Optional: defaults to 1m. Must not be negative. DialTimeout time.Duration // Interval between protocol ticks with each connected peer. @@ -316,7 +316,7 @@ func New(cfg Config) (res *Blockchain, err error) { cfg.P2P.AttemptConnPeers = cfg.P2P.MinPeers + 10 } if cfg.P2P.DialTimeout == 0 { - cfg.P2P.DialTimeout = 5 * time.Second + cfg.P2P.DialTimeout = time.Minute } if cfg.P2P.ProtoTickInterval == 0 { cfg.P2P.ProtoTickInterval = 2 * time.Second