Skip to content

Commit

Permalink
add config.DeadlockDetectionThreshold (algorand#3339)
Browse files Browse the repository at this point in the history
Summary
This allows for the deadlock detection threshold to be set by configuration.

Test Plan
Existing tests should pass.
  • Loading branch information
cce authored Dec 22, 2021
1 parent 6be3ffa commit 4cb4241
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 3 deletions.
5 changes: 4 additions & 1 deletion config/localTemplate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"`
Expand Down
3 changes: 2 additions & 1 deletion config/local_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
package config

var defaultLocal = Local{
Version: 19,
Version: 20,
AccountUpdatesStatsInterval: 5000000000,
AccountsRebuildSynchronousMode: 1,
AnnounceParticipationKey: true,
Expand All @@ -44,6 +44,7 @@ var defaultLocal = Local{
DNSBootstrapID: "<network>.algorand.network",
DNSSecurityFlags: 1,
DeadlockDetection: 0,
DeadlockDetectionThreshold: 30,
DisableLocalhostConnectionRateLimit: true,
DisableNetworking: false,
DisableOutgoingConnectionThrottling: false,
Expand Down
3 changes: 3 additions & 0 deletions daemon/algod/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion installer/config.json.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Version": 19,
"Version": 20,
"AccountUpdatesStatsInterval": 5000000000,
"AccountsRebuildSynchronousMode": 1,
"AnnounceParticipationKey": true,
Expand All @@ -23,6 +23,7 @@
"DNSBootstrapID": "<network>.algorand.network",
"DNSSecurityFlags": 1,
"DeadlockDetection": 0,
"DeadlockDetectionThreshold": 30,
"DisableLocalhostConnectionRateLimit": true,
"DisableNetworking": false,
"DisableOutgoingConnectionThrottling": false,
Expand Down
98 changes: 98 additions & 0 deletions test/testdata/configs/config-v20.json
Original file line number Diff line number Diff line change
@@ -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": "<network>.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
}

0 comments on commit 4cb4241

Please sign in to comment.