Skip to content

Commit

Permalink
node, ir: set default dial timeout to 1 minute
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
End-rey committed Oct 8, 2024
1 parent 624f636 commit 5b25511
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-ir/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 50 in cmd/neofs-ir/defaults.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-ir/defaults.go#L50

Added line #L50 was not covered by tests
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)

Check warning on line 55 in cmd/neofs-ir/defaults.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-ir/defaults.go#L55

Added line #L55 was not covered by tests
cfg.SetDefault("mainnet.reconnections_number", 5)
cfg.SetDefault("mainnet.reconnections_delay", 5*time.Second)

Expand Down
4 changes: 2 additions & 2 deletions cmd/neofs-node/config/apiclient/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/neofs-node/config/morph/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions config/example/ir.env
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions config/example/ir.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -96,7 +96,7 @@ nns: # Optional configuration of the NNS domains processed during the FS chain d
# Defaults to '[email protected]'

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
Expand Down
6 changes: 3 additions & 3 deletions config/example/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion config/mainnet/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion config/testnet/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/storage-node-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).<br/>Negative value disables caching.<br/>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. |
Expand Down Expand Up @@ -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. |

Expand Down
4 changes: 2 additions & 2 deletions pkg/innerring/internal/blockchain/blockchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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

Check warning on line 319 in pkg/innerring/internal/blockchain/blockchain.go

View check run for this annotation

Codecov / codecov/patch

pkg/innerring/internal/blockchain/blockchain.go#L319

Added line #L319 was not covered by tests
}
if cfg.P2P.ProtoTickInterval == 0 {
cfg.P2P.ProtoTickInterval = 2 * time.Second
Expand Down

0 comments on commit 5b25511

Please sign in to comment.