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

refactor: only log errors different from ErrNoPeersAvailable when selecting random peers. #864

Merged
merged 1 commit into from
Nov 3, 2023

Conversation

richard-ramos
Copy link
Member

Description

@vitvly reported that he sees often in status-go logs the line "could not retrieve random peer from slot" error="no suitable peers found". When reviewing the code, I see that since status-go does not use service slots for retrieving peers supporting filter protocol, but instead depends on the peers that are discovered, this error was generated and logged very frequently.

Since this is not an error per se but a possible outcome of just not having peers registered in the service slots, I did a small refactor to only log errors if different from ErrNoPeersAvailable, as well as adding more information to the logs like the protocol and pubsub topic being retrieved.

I also include a minor refactor to not need to use pointers for the peerID

…electing random peers.

Includes a minor refactor to not need to use pointers for the peerID
@status-im-auto
Copy link

status-im-auto commented Nov 3, 2023

Jenkins Builds

Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 728e3f3 #1 2023-11-03 13:57:59 ~3 min nix-flake 📄log
✔️ 728e3f3 #1 2023-11-03 13:58:32 ~3 min linux 📦deb
✔️ 728e3f3 #1 2023-11-03 13:58:38 ~3 min ios 📦tgz
✔️ 728e3f3 #1 2023-11-03 13:59:16 ~4 min android 📦tgz
✔️ 728e3f3 #1 2023-11-03 14:01:25 ~6 min tests 📄log
✔️ 728e3f3 #1 2023-11-03 14:01:29 ~6 min tests 📄log

if err == nil {
return peerID, nil
} else if !errors.Is(err, ErrNoPeersAvailable) {
pm.logger.Debug("could not retrieve random peer from slot", zap.String("protocol", string(criteria.Proto)), zap.String("pubsubTopic", criteria.PubsubTopic), zap.Error(err))

Check failure

Code scanning / CodeQL

Log entries created from user input High

This log entry depends on a
user-provided value
.
@richard-ramos richard-ramos merged commit 67d57a3 into master Nov 3, 2023
3 of 4 checks passed
@richard-ramos richard-ramos deleted the log/select branch November 3, 2023 16:13
chaitanyaprem added a commit that referenced this pull request Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants