Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Networking] logging dial addresses #1492

Merged
merged 10 commits into from Oct 21, 2021

Conversation

yhassanzadeh13
Copy link
Contributor

@yhassanzadeh13 yhassanzadeh13 commented Oct 15, 2021

To facilitate tracing issues related to unicasts, and as a follow-up on https://github.com/dapperlabs/flow-go/issues/5941, this PR extracts and logs unicast multi-addresses on the happy (through debug level logs), and unhappy (through returned error) paths.

Per conversation with @vishalchangrani we also remove the hard coding log-level for the networking layer from the scaffold.

@yhassanzadeh13 yhassanzadeh13 marked this pull request as ready for review October 15, 2021 22:33
fnb.Me.NodeID(),
myAddr,
fnb.NetworkKey,
fnb.RootBlock.ID(),
fnb.RootChainID,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused parameter

@codecov-commenter
Copy link

codecov-commenter commented Oct 15, 2021

Codecov Report

Merging #1492 (0549284) into master (4233145) will increase coverage by 0.01%.
The diff coverage is 80.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1492      +/-   ##
==========================================
+ Coverage   55.14%   55.16%   +0.01%     
==========================================
  Files         520      520              
  Lines       32413    32418       +5     
==========================================
+ Hits        17875    17883       +8     
+ Misses      12141    12138       -3     
  Partials     2397     2397              
Flag Coverage Δ
unittests 55.16% <80.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/scaffold.go 0.90% <0.00%> (+<0.01%) ⬆️
network/p2p/middleware.go 0.00% <0.00%> (ø)
network/p2p/libp2pNode.go 63.53% <88.88%> (+0.61%) ⬆️
consensus/hotstuff/event_loop.go 54.66% <0.00%> (+2.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4233145...0549284. Read the comment docs.

@@ -460,36 +461,41 @@ func (n *Node) CreateStream(ctx context.Context, peerID peer.ID) (libp2pnet.Stre
}()

if err != nil {
n.logger.Warn().Err(err).Str("peerID", peerID.Pretty()).Msg("could not find addresses")
lg.Warn().Err(err).Msg("address not found in both peer store and dht")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smnzhu is there a reason why on line 456-461 ☝️ we do:

func() {
timedCtx, cancel := context.WithTimeout(ctx, findPeerQueryTimeout)
defer cancel()
// try to find the peer using the dht
_, err = n.dht.FindPeer(timedCtx, peerID)
}()

instead of just:

  	timedCtx, cancel := context.WithTimeout(ctx, findPeerQueryTimeout)
  	defer cancel()
  	// try to find the peer using the dht
  	_, err = n.dht.FindPeer(timedCtx, peerID)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it's because otherwise the defer will not be run until much later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the FindPeer succeeds, I want to cancel immediately. But tbh it probably doesn't make a difference here.

Co-authored-by: Vishal <1117327+vishalchangrani@users.noreply.github.com>
network/p2p/libp2pNode.go Show resolved Hide resolved
network/p2p/libp2pNode.go Outdated Show resolved Hide resolved
@yhassanzadeh13 yhassanzadeh13 merged commit 11299bb into master Oct 21, 2021
@yhassanzadeh13 yhassanzadeh13 deleted the yahya/5941-adding-dial-log-libp2p branch October 21, 2021 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants