From 4cb424160db19b9412cedf81b248314084af545c Mon Sep 17 00:00:00 2001 From: chris erway <51567+cce@users.noreply.github.com> Date: Tue, 21 Dec 2021 21:17:32 -0500 Subject: [PATCH] add config.DeadlockDetectionThreshold (#3339) Summary This allows for the deadlock detection threshold to be set by configuration. Test Plan Existing tests should pass. --- config/localTemplate.go | 5 +- config/local_defaults.go | 3 +- daemon/algod/server.go | 3 + installer/config.json.example | 3 +- test/testdata/configs/config-v20.json | 98 +++++++++++++++++++++++++++ 5 files changed, 109 insertions(+), 3 deletions(-) create mode 100644 test/testdata/configs/config-v20.json diff --git a/config/localTemplate.go b/config/localTemplate.go index 20a141e8cd..977c8680dd 100644 --- a/config/localTemplate.go +++ b/config/localTemplate.go @@ -41,7 +41,7 @@ type Local struct { // Version tracks the current version of the defaults so we can migrate old -> new // This is specifically important whenever we decide to change the default value // for an existing parameter. This field tag must be updated any time we add a new version. - Version uint32 `version[0]:"0" version[1]:"1" version[2]:"2" version[3]:"3" version[4]:"4" version[5]:"5" version[6]:"6" version[7]:"7" version[8]:"8" version[9]:"9" version[10]:"10" version[11]:"11" version[12]:"12" version[13]:"13" version[14]:"14" version[15]:"15" version[16]:"16" version[17]:"17" version[18]:"18" version[19]:"19"` + Version uint32 `version[0]:"0" version[1]:"1" version[2]:"2" version[3]:"3" version[4]:"4" version[5]:"5" version[6]:"6" version[7]:"7" version[8]:"8" version[9]:"9" version[10]:"10" version[11]:"11" version[12]:"12" version[13]:"13" version[14]:"14" version[15]:"15" version[16]:"16" version[17]:"17" version[18]:"18" version[19]:"19" version[20]:"20"` // environmental (may be overridden) // When enabled, stores blocks indefinitally, otherwise, only the most recents blocks @@ -192,6 +192,9 @@ type Local struct { // negative (-1) to disable, positive (1) to enable, 0 for default. DeadlockDetection int `version[1]:"0"` + // The threshold used for deadlock detection, in seconds. + DeadlockDetectionThreshold int `version[20]:"30"` + // Prefer to run algod Hosted (under algoh) // Observed by `goal` for now. RunHosted bool `version[3]:"false"` diff --git a/config/local_defaults.go b/config/local_defaults.go index ae1aa7043f..a1b6f33e7a 100644 --- a/config/local_defaults.go +++ b/config/local_defaults.go @@ -20,7 +20,7 @@ package config var defaultLocal = Local{ - Version: 19, + Version: 20, AccountUpdatesStatsInterval: 5000000000, AccountsRebuildSynchronousMode: 1, AnnounceParticipationKey: true, @@ -44,6 +44,7 @@ var defaultLocal = Local{ DNSBootstrapID: ".algorand.network", DNSSecurityFlags: 1, DeadlockDetection: 0, + DeadlockDetectionThreshold: 30, DisableLocalhostConnectionRateLimit: true, DisableNetworking: false, DisableOutgoingConnectionThrottling: false, diff --git a/daemon/algod/server.go b/daemon/algod/server.go index 1eedac466b..775c5291a3 100644 --- a/daemon/algod/server.go +++ b/daemon/algod/server.go @@ -98,6 +98,9 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes // Default setting - host app should configure this // If host doesn't, the default is Disable = false (so, enabled) } + if !deadlock.Opts.Disable { + deadlock.Opts.DeadlockTimeout = time.Second * time.Duration(cfg.DeadlockDetectionThreshold) + } // if we have the telemetry enabled, we want to use it's sessionid as part of the // collected metrics decorations. diff --git a/installer/config.json.example b/installer/config.json.example index fac1122017..3a77e301bf 100644 --- a/installer/config.json.example +++ b/installer/config.json.example @@ -1,5 +1,5 @@ { - "Version": 19, + "Version": 20, "AccountUpdatesStatsInterval": 5000000000, "AccountsRebuildSynchronousMode": 1, "AnnounceParticipationKey": true, @@ -23,6 +23,7 @@ "DNSBootstrapID": ".algorand.network", "DNSSecurityFlags": 1, "DeadlockDetection": 0, + "DeadlockDetectionThreshold": 30, "DisableLocalhostConnectionRateLimit": true, "DisableNetworking": false, "DisableOutgoingConnectionThrottling": false, diff --git a/test/testdata/configs/config-v20.json b/test/testdata/configs/config-v20.json new file mode 100644 index 0000000000..3a77e301bf --- /dev/null +++ b/test/testdata/configs/config-v20.json @@ -0,0 +1,98 @@ +{ + "Version": 20, + "AccountUpdatesStatsInterval": 5000000000, + "AccountsRebuildSynchronousMode": 1, + "AnnounceParticipationKey": true, + "Archival": false, + "BaseLoggerDebugLevel": 4, + "BlockServiceCustomFallbackEndpoints": "", + "BroadcastConnectionsLimit": -1, + "CadaverSizeTarget": 1073741824, + "CatchpointFileHistoryLength": 365, + "CatchpointInterval": 10000, + "CatchpointTracking": 0, + "CatchupBlockDownloadRetryAttempts": 1000, + "CatchupBlockValidateMode": 0, + "CatchupFailurePeerRefreshRate": 10, + "CatchupGossipBlockFetchTimeoutSec": 4, + "CatchupHTTPBlockFetchTimeoutSec": 4, + "CatchupLedgerDownloadRetryAttempts": 50, + "CatchupParallelBlocks": 16, + "ConnectionsRateLimitingCount": 60, + "ConnectionsRateLimitingWindowSeconds": 1, + "DNSBootstrapID": ".algorand.network", + "DNSSecurityFlags": 1, + "DeadlockDetection": 0, + "DeadlockDetectionThreshold": 30, + "DisableLocalhostConnectionRateLimit": true, + "DisableNetworking": false, + "DisableOutgoingConnectionThrottling": false, + "EnableAccountUpdatesStats": false, + "EnableAgreementReporting": false, + "EnableAgreementTimeMetrics": false, + "EnableAssembleStats": false, + "EnableBlockService": false, + "EnableBlockServiceFallbackToArchiver": true, + "EnableCatchupFromArchiveServers": false, + "EnableDeveloperAPI": false, + "EnableGossipBlockService": true, + "EnableIncomingMessageFilter": false, + "EnableLedgerService": false, + "EnableMetricReporting": false, + "EnableOutgoingNetworkMessageFiltering": true, + "EnablePingHandler": true, + "EnableProcessBlockStats": false, + "EnableProfiler": false, + "EnableRequestLogger": false, + "EnableTopAccountsReporting": false, + "EnableVerbosedTransactionSyncLogging": false, + "EndpointAddress": "127.0.0.1:0", + "FallbackDNSResolverAddress": "", + "ForceFetchTransactions": false, + "ForceRelayMessages": false, + "GossipFanout": 4, + "IncomingConnectionsLimit": 800, + "IncomingMessageFilterBucketCount": 5, + "IncomingMessageFilterBucketSize": 512, + "IsIndexerActive": false, + "LedgerSynchronousMode": 2, + "LogArchiveMaxAge": "", + "LogArchiveName": "node.archive.log", + "LogSizeLimit": 1073741824, + "MaxCatchpointDownloadDuration": 7200000000000, + "MaxConnectionsPerIP": 30, + "MinCatchpointFileDownloadBytesPerSecond": 20480, + "NetAddress": "", + "NetworkMessageTraceServer": "", + "NetworkProtocolVersion": "", + "NodeExporterListenAddress": ":9100", + "NodeExporterPath": "./node_exporter", + "OptimizeAccountsDatabaseOnStartup": false, + "OutgoingMessageFilterBucketCount": 3, + "OutgoingMessageFilterBucketSize": 128, + "ParticipationKeysRefreshInterval": 60000000000, + "PeerConnectionsUpdateInterval": 3600, + "PeerPingPeriodSeconds": 0, + "PriorityPeers": {}, + "ProposalAssemblyTime": 250000000, + "PublicAddress": "", + "ReconnectTime": 60000000000, + "ReservedFDs": 256, + "RestReadTimeoutSeconds": 15, + "RestWriteTimeoutSeconds": 120, + "RunHosted": false, + "SuggestedFeeBlockHistory": 3, + "SuggestedFeeSlidingWindowSize": 50, + "TLSCertFile": "", + "TLSKeyFile": "", + "TelemetryToLog": true, + "TransactionSyncDataExchangeRate": 0, + "TransactionSyncSignificantMessageThreshold": 0, + "TxPoolExponentialIncreaseFactor": 2, + "TxPoolSize": 15000, + "TxSyncIntervalSeconds": 60, + "TxSyncServeResponseSize": 1000000, + "TxSyncTimeoutSeconds": 30, + "UseXForwardedForAddressField": "", + "VerifiedTranscationsCacheSize": 30000 +}