Skip to content

Commit 4cb4241

Browse files
authored
add config.DeadlockDetectionThreshold (#3339)
Summary This allows for the deadlock detection threshold to be set by configuration. Test Plan Existing tests should pass.
1 parent 6be3ffa commit 4cb4241

File tree

5 files changed

+109
-3
lines changed

5 files changed

+109
-3
lines changed

config/localTemplate.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type Local struct {
4141
// Version tracks the current version of the defaults so we can migrate old -> new
4242
// This is specifically important whenever we decide to change the default value
4343
// for an existing parameter. This field tag must be updated any time we add a new version.
44-
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"`
44+
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"`
4545

4646
// environmental (may be overridden)
4747
// When enabled, stores blocks indefinitally, otherwise, only the most recents blocks
@@ -192,6 +192,9 @@ type Local struct {
192192
// negative (-1) to disable, positive (1) to enable, 0 for default.
193193
DeadlockDetection int `version[1]:"0"`
194194

195+
// The threshold used for deadlock detection, in seconds.
196+
DeadlockDetectionThreshold int `version[20]:"30"`
197+
195198
// Prefer to run algod Hosted (under algoh)
196199
// Observed by `goal` for now.
197200
RunHosted bool `version[3]:"false"`

config/local_defaults.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
package config
2121

2222
var defaultLocal = Local{
23-
Version: 19,
23+
Version: 20,
2424
AccountUpdatesStatsInterval: 5000000000,
2525
AccountsRebuildSynchronousMode: 1,
2626
AnnounceParticipationKey: true,
@@ -44,6 +44,7 @@ var defaultLocal = Local{
4444
DNSBootstrapID: "<network>.algorand.network",
4545
DNSSecurityFlags: 1,
4646
DeadlockDetection: 0,
47+
DeadlockDetectionThreshold: 30,
4748
DisableLocalhostConnectionRateLimit: true,
4849
DisableNetworking: false,
4950
DisableOutgoingConnectionThrottling: false,

daemon/algod/server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ func (s *Server) Initialize(cfg config.Local, phonebookAddresses []string, genes
9898
// Default setting - host app should configure this
9999
// If host doesn't, the default is Disable = false (so, enabled)
100100
}
101+
if !deadlock.Opts.Disable {
102+
deadlock.Opts.DeadlockTimeout = time.Second * time.Duration(cfg.DeadlockDetectionThreshold)
103+
}
101104

102105
// if we have the telemetry enabled, we want to use it's sessionid as part of the
103106
// collected metrics decorations.

installer/config.json.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"Version": 19,
2+
"Version": 20,
33
"AccountUpdatesStatsInterval": 5000000000,
44
"AccountsRebuildSynchronousMode": 1,
55
"AnnounceParticipationKey": true,
@@ -23,6 +23,7 @@
2323
"DNSBootstrapID": "<network>.algorand.network",
2424
"DNSSecurityFlags": 1,
2525
"DeadlockDetection": 0,
26+
"DeadlockDetectionThreshold": 30,
2627
"DisableLocalhostConnectionRateLimit": true,
2728
"DisableNetworking": false,
2829
"DisableOutgoingConnectionThrottling": false,
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"Version": 20,
3+
"AccountUpdatesStatsInterval": 5000000000,
4+
"AccountsRebuildSynchronousMode": 1,
5+
"AnnounceParticipationKey": true,
6+
"Archival": false,
7+
"BaseLoggerDebugLevel": 4,
8+
"BlockServiceCustomFallbackEndpoints": "",
9+
"BroadcastConnectionsLimit": -1,
10+
"CadaverSizeTarget": 1073741824,
11+
"CatchpointFileHistoryLength": 365,
12+
"CatchpointInterval": 10000,
13+
"CatchpointTracking": 0,
14+
"CatchupBlockDownloadRetryAttempts": 1000,
15+
"CatchupBlockValidateMode": 0,
16+
"CatchupFailurePeerRefreshRate": 10,
17+
"CatchupGossipBlockFetchTimeoutSec": 4,
18+
"CatchupHTTPBlockFetchTimeoutSec": 4,
19+
"CatchupLedgerDownloadRetryAttempts": 50,
20+
"CatchupParallelBlocks": 16,
21+
"ConnectionsRateLimitingCount": 60,
22+
"ConnectionsRateLimitingWindowSeconds": 1,
23+
"DNSBootstrapID": "<network>.algorand.network",
24+
"DNSSecurityFlags": 1,
25+
"DeadlockDetection": 0,
26+
"DeadlockDetectionThreshold": 30,
27+
"DisableLocalhostConnectionRateLimit": true,
28+
"DisableNetworking": false,
29+
"DisableOutgoingConnectionThrottling": false,
30+
"EnableAccountUpdatesStats": false,
31+
"EnableAgreementReporting": false,
32+
"EnableAgreementTimeMetrics": false,
33+
"EnableAssembleStats": false,
34+
"EnableBlockService": false,
35+
"EnableBlockServiceFallbackToArchiver": true,
36+
"EnableCatchupFromArchiveServers": false,
37+
"EnableDeveloperAPI": false,
38+
"EnableGossipBlockService": true,
39+
"EnableIncomingMessageFilter": false,
40+
"EnableLedgerService": false,
41+
"EnableMetricReporting": false,
42+
"EnableOutgoingNetworkMessageFiltering": true,
43+
"EnablePingHandler": true,
44+
"EnableProcessBlockStats": false,
45+
"EnableProfiler": false,
46+
"EnableRequestLogger": false,
47+
"EnableTopAccountsReporting": false,
48+
"EnableVerbosedTransactionSyncLogging": false,
49+
"EndpointAddress": "127.0.0.1:0",
50+
"FallbackDNSResolverAddress": "",
51+
"ForceFetchTransactions": false,
52+
"ForceRelayMessages": false,
53+
"GossipFanout": 4,
54+
"IncomingConnectionsLimit": 800,
55+
"IncomingMessageFilterBucketCount": 5,
56+
"IncomingMessageFilterBucketSize": 512,
57+
"IsIndexerActive": false,
58+
"LedgerSynchronousMode": 2,
59+
"LogArchiveMaxAge": "",
60+
"LogArchiveName": "node.archive.log",
61+
"LogSizeLimit": 1073741824,
62+
"MaxCatchpointDownloadDuration": 7200000000000,
63+
"MaxConnectionsPerIP": 30,
64+
"MinCatchpointFileDownloadBytesPerSecond": 20480,
65+
"NetAddress": "",
66+
"NetworkMessageTraceServer": "",
67+
"NetworkProtocolVersion": "",
68+
"NodeExporterListenAddress": ":9100",
69+
"NodeExporterPath": "./node_exporter",
70+
"OptimizeAccountsDatabaseOnStartup": false,
71+
"OutgoingMessageFilterBucketCount": 3,
72+
"OutgoingMessageFilterBucketSize": 128,
73+
"ParticipationKeysRefreshInterval": 60000000000,
74+
"PeerConnectionsUpdateInterval": 3600,
75+
"PeerPingPeriodSeconds": 0,
76+
"PriorityPeers": {},
77+
"ProposalAssemblyTime": 250000000,
78+
"PublicAddress": "",
79+
"ReconnectTime": 60000000000,
80+
"ReservedFDs": 256,
81+
"RestReadTimeoutSeconds": 15,
82+
"RestWriteTimeoutSeconds": 120,
83+
"RunHosted": false,
84+
"SuggestedFeeBlockHistory": 3,
85+
"SuggestedFeeSlidingWindowSize": 50,
86+
"TLSCertFile": "",
87+
"TLSKeyFile": "",
88+
"TelemetryToLog": true,
89+
"TransactionSyncDataExchangeRate": 0,
90+
"TransactionSyncSignificantMessageThreshold": 0,
91+
"TxPoolExponentialIncreaseFactor": 2,
92+
"TxPoolSize": 15000,
93+
"TxSyncIntervalSeconds": 60,
94+
"TxSyncServeResponseSize": 1000000,
95+
"TxSyncTimeoutSeconds": 30,
96+
"UseXForwardedForAddressField": "",
97+
"VerifiedTranscationsCacheSize": 30000
98+
}

0 commit comments

Comments
 (0)