Repository navigation
chore(node,wire): lower WARN/ERROR logs that aren't problems - #21
Open
lorenzolfm wants to merge 7 commits into
Open
lorenzolfm wants to merge 7 commits into
lorenzolfm wants to merge 7 commits into
Conversation
…default at debug
With no config file at the default `{datadir}/config.toml`, every start
printed `WARN Could not read config file, ignoring it`. That's the normal
case, so log it at debug. A missing explicit `--config-file`, or a file
that can't be parsed, stays a warning, now with the path and the error
(the TOML error used to be at debug only).
`get_config_file()` was called once each for descriptors, xpubs and addresses, so every config warning was printed three times. Read it once in `setup_wallet` and pass it to the three getters.
anchors.json only exists after a utreexo peer was saved, so a fresh start always printed `Failed to init Utreexo peers: anchors.json does not exist yet, or is invalid`. Log a missing file at debug, and keep the warning for a file that can't be read or parsed, now with the error.
A dead seed printed `ERROR DNS lookup failed: <err>`, without the host, then `WARN No peer addresses read from DNS host: <host>`. One dead seed out of several isn't an error: log a single warning with the host and the error. A lookup that succeeds with no addresses still logs the existing warning.
This is a remote peer's behaviour (e.g. `sendtemplate` before `verack`), and the warning Debug-printed the whole message. Log the command name at debug instead. The peer is still disconnected as before.
Right after the assume-utreexo jump, the sync node logged `ERROR 90: crates/floresta-wire/src/p2p_wire/node/sync_ctx.rs - NoPeersAvailable` several times while it had no peer to ask for blocks yet. That's a transient state, so log it at debug. Other errors at these two sites still go through `try_and_log!`.
Every Ctrl-C printed `ERROR 484: .../node/mod.rs - ChannelSend(SendError { .. })`
for peers that were already gone, and `WARN No connected Utreexo peers to
save to disk` when no utreexo peer was connected. Neither is a problem
during shutdown, so log both at debug.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description and Notes
Part of
getfloresta/floresta#167("[tracking-issue] Audit logging and identify improvements").From the issue:
On a fresh signet start, a restart, and a mainnet start, every WARN/ERROR line florestad printed came from one of the cases below, and none of them was a problem. This PR lowers those lines, and where a real problem is still possible it keeps the WARN and makes the message say what failed. One commit per case, so any of them can be dropped.
WARN Could not read config file, ignoring it×3 on every start (no config file at the default path)DEBUG No config file at <path>, using defaults, once. A missing explicit--config-filestays WARN and names the pathWARN Could not parse config file, ignoring it×3, with the parse error only at DEBUGWARN Failed to init Utreexo peers: anchors.json does not exist yet, or is invalidon every fresh startERROR DNS lookup failed: <err>+WARN No peer addresses read from DNS host: <host>for one dead seedWARN DNS lookup failed for host <host>: <err>. An empty answer still logs the existing WARNWARN unexpected message: Unknown { command: CommandString("sendtemplate"), payload: [] } from peer NDEBUG unexpected message: sendtemplate from peer N(the peer is still disconnected, as before)ERROR 90: crates/floresta-wire/src/p2p_wire/node/sync_ctx.rs - NoPeersAvailable(and255:) right after the assume-utreexo jumpNoPeersAvailableat these two sites; other errors there stay ERRORERROR 484: crates/floresta-wire/src/p2p_wire/node/mod.rs - ChannelSend(SendError { .. })andWARN No connected Utreexo peers to save to diskon every Ctrl-CCommit 2 is a small refactor:
get_config_file()was called three times during wallet setup (once each for descriptors, xpubs and addresses), so each config message was printed three times. Now it is read once and passed in.Not in this PR (possible follow-ups):
try_and_log!prints{line}: {file} - {err:?}, which doesn't tell an operator what failed. Giving it a context string touches its ~46 call sites.sendtemplatebetweenversionandverackis disconnected withUnexpectedMessage. That's behaviour, not logging, so it isn't changed here.How to verify the changes you have done?
florestad --log-to-fileat the default level, same machine, fresh data dirs:DNS lookup failed for host x1000.signet.seed.utreexo.net: …)All master lines were from the cases above. With
RUST_LOG=info,floresta_wire=debug,floresta_node=debug, each lowered message still shows up once at DEBUG:No config file at …,No anchors.json yet…,unexpected message: sendtemplate from peer N,Could not send shutdown to peer N: ChannelSend(..),No connected Utreexo peers to save to disk.NoPeersAvailabledidn't come up in either mainnet run with this PR (15 and 20 min, both past the assume-utreexo jump), so its new DEBUG line wasn't observed at runtime. On master it showed up 9× in the 20 s after the jump. It depends on peer timing, and the change is amatchonWireError::NoPeersAvailablethat falls through totry_and_log!for any other error.Config cases (signet, 30 s each):
<datadir>/signet/config.toml→ oneWARN Could not parse config file <path>, ignoring it: TOML parse error at line 1, column 8 …(with toml's caret snippet)--config-file /nonexistent/floresta.toml→ oneWARN Could not read config file /nonexistent/floresta.toml, ignoring it: No such file or directory (os error 2)cargo +nightly fmt --check,cargo hack clippy --feature-powerset --all-targets -- -D warningsonfloresta-wireandfloresta-node, andcargo test -p floresta-wire -p floresta-nodepass.