Page MenuHomePhabricator

Merge #13577: logging: avoid nStart may be used uninitialized in AppInitMain warning
ClosedPublic

Authored by nakihito on Jun 18 2020, 20:59.

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Restricted Project
Commits
rABC8baac1e576e1: Merge #13577: logging: avoid nStart may be used uninitialized in AppInitMain…
Summary

2dcd7b4ec logging: avoid nStart may be used uninitialized in AppInitMain warning (mruddy)

Pull request description:

Was getting the following compiler warning:

```
init.cpp: In function ‘bool AppInitMain()’:
init.cpp:1616:60: warning: ‘nStart’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         LogPrintf(" block index %15dms\n", GetTimeMillis() - nStart);
```

It's ok without this PR, but this PR renames `nStart` to `load_block_index_start_time`, makes it `const`, and also reduces the scope of the variable.

The logging line is moved such that the the time spent will be logged even if a shutdown is requested while the index is being loaded.

Having the log message output even when a shutdown is requested may be how this was intended to work before anyways. That could explain the leading space, as such a log message now looks like:
```
2018-06-30T11:34:05Z [0%]...[16%]...[33%]...[50%]... block index           25750ms
2018-06-30T11:34:17Z Shutdown requested. Exiting.
```

Tree-SHA512: 967048afbc31f2ce8f80ae7d33fee0bdcbe94550cf2b5b662087e2a7cff14a8bf43d909b30f930660c184ec6c3c7e1302a84e3e54fc1723f7412827f4bf2c518

Backport of Core PR13577

Test Plan
ninja
ninja check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Owners added a reviewer: Restricted Owners Package.Jun 18 2020, 20:59

[Bot Message]
One or more PR numbers were detected in the summary.
Links to those PRs have been inserted into the summary for reference.

Snippet of first build failure:

[21:04:29] :	 [Step 1/2]  [0m [1;30mp2p_leak_tx.py                          | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_createmultisig.py                   | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_deprecated.py                       | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_estimatefee.py                      | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_psbt.py                             | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_rawtransaction.py                   | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_scantxoutset.py                     | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_signmessage.py                      | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_signrawtransaction.py               | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mrpc_txoutproof.py                       | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mtool_wallet.py                          | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_abandonconflict.py               | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_address_types.py                 | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_avoidreuse.py                    | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_backup.py                        | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_balance.py                       | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_basic.py                         | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_create_tx.py                     | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_createwallet.py                  | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_createwallet.py --usecli         | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_dump.py                          | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_encryption.py                    | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_groups.py                        | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_hd.py                            | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_import_rescan.py                 | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_import_with_label.py             | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_importmulti.py                   | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_importprunedfunds.py             | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_keypool.py                       | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_keypool_topup.py                 | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_labels.py                        | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_listreceivedby.py                | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_listsinceblock.py                | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_listtransactions.py              | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_multiwallet.py                   | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_multiwallet.py --usecli          | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_resendwallettransactions.py      | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_txn_clone.py                     | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_txn_clone.py --mineblock         | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_txn_doublespend.py               | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_txn_doublespend.py --mineblock   | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [1;30mwallet_zapwallettxes.py                 | ○ Skipped | 0 s
[21:04:29] :	 [Step 1/2]  [0m [0;31mabc_p2p_avalanche.py                    | ✖ Failed  | 122 s
[21:04:29] :	 [Step 1/2]  [0m [0;31m [1m
[21:04:29] :	 [Step 1/2] ALL                                     | ✖ Failed  | 403 s (accumulated) 
[21:04:29] :	 [Step 1/2]  [0m [0mRuntime: 163 s
[21:04:29] :	 [Step 1/2] 
[21:04:29] :	 [Step 1/2] FAILED: test/CMakeFiles/check-functional 
[21:04:29] :	 [Step 1/2] cd /work/build-without-wallet/test && /usr/bin/cmake -E env /usr/bin/python3.7 ./functional/test_runner.py
[21:04:29] :	 [Step 1/2] ninja: build stopped: subcommand failed.
[21:04:29] :	 [Step 1/2] *** Output of /tmp/sanitizer_logs/*.log.* ***
[21:04:29]W:	 [Step 1/2] ++ print_sanitizers_log
[21:04:29]W:	 [Step 1/2] ++ for log in "${SAN_LOG_DIR}"/*.log.*
[21:04:29]W:	 [Step 1/2] ++ echo '*** Output of /tmp/sanitizer_logs/*.log.* ***'
[21:04:29]W:	 [Step 1/2] ++ cat '/tmp/sanitizer_logs/*.log.*'
[21:04:29]W:	 [Step 1/2] cat: '/tmp/sanitizer_logs/*.log.*': No such file or directory
[21:04:29]W:	 [Step 1/2] cp: cannot stat '/work/build': No such file or directory
[21:04:29]W:	 [Step 1/2] cp: cannot stat '/work/ibd/debug.log': No such file or directory
[21:04:33]W:	 [Step 1/2] Process exited with code 1
[21:04:33]E:	 [Step 1/2] Process exited with code 1 (Step: Command Line)
This revision is now accepted and ready to land.Jun 18 2020, 21:16