Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
378905df
Commit
378905df
authored
3 years ago
by
Robert Klotzner
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Warn on low connectivity. (#3408)
* Warn on low connectivity. * Better timeout and docs. * Review remarks.
parent
bf7aff26
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
polkadot/node/network/gossip-support/src/lib.rs
+42
-3
42 additions, 3 deletions
polkadot/node/network/gossip-support/src/lib.rs
with
42 additions
and
3 deletions
polkadot/node/network/gossip-support/src/lib.rs
+
42
−
3
View file @
378905df
...
...
@@ -52,6 +52,16 @@ const LOG_TARGET: &str = "parachain::gossip-support";
// since the last authority discovery resolution failure.
const
BACKOFF_DURATION
:
Duration
=
Duration
::
from_secs
(
5
);
/// Duration after which we consider low connectivity a problem.
///
/// Especially at startup low connectivity is expected (authority discovery cache needs to be
/// populated). Authority discovery on Kusama takes around 8 minutes, so warning after 10 minutes
/// should be fine:
///
/// https://github.com/paritytech/substrate/blob/fc49802f263529160635471c8a17888846035f5d/client/authority-discovery/src/lib.rs#L88
///
const
LOW_CONNECTIVITY_WARN_DELAY
:
Duration
=
Duration
::
from_secs
(
600
);
/// The Gossip Support subsystem.
pub
struct
GossipSupport
{
keystore
:
SyncCryptoStorePtr
,
...
...
@@ -64,6 +74,13 @@ struct State {
// at least a third of authorities the last time.
// `None` otherwise.
last_failure
:
Option
<
Instant
>
,
/// First time we did not reach our connectivity threshold.
///
/// This is the time of the first failed attempt to connect to >2/3 of all validators in a
/// potential sequence of failed attempts. It will be cleared once we reached >2/3
/// connectivity.
failure_start
:
Option
<
Instant
>
,
}
impl
GossipSupport
{
...
...
@@ -313,10 +330,32 @@ impl State {
// issue another request for the same session
// if at least a third of the authorities were not resolved
self
.last_failure
=
if
failures
>=
num
/
3
{
Some
(
Instant
::
now
())
if
failures
>=
num
/
3
{
let
timestamp
=
Instant
::
now
();
match
self
.failure_start
{
None
=>
self
.failure_start
=
Some
(
timestamp
),
Some
(
first
)
if
first
.elapsed
()
>=
LOW_CONNECTIVITY_WARN_DELAY
=>
{
tracing
::
warn!
(
target
:
LOG_TARGET
,
connected
=
?
(
num
-
failures
),
target
=
?
num
,
"Low connectivity - authority lookup failed for too many validators."
);
}
Some
(
_
)
=>
{
tracing
::
debug!
(
target
:
LOG_TARGET
,
connected
=
?
(
num
-
failures
),
target
=
?
num
,
"Low connectivity (due to authority lookup failures) - expected on startup."
);
}
}
self
.last_failure
=
Some
(
timestamp
);
}
else
{
None
self
.last_failure
=
None
;
self
.failure_start
=
None
;
};
Ok
(())
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment