-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Improve PID file error handling #15278
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
Conversation
src/util/system.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand why this doesn't return an error status, and that not being able to create the PID file is not fatal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
Concept ACK, thanks for adding more relevant logging for diagnostics. |
|
Concept ACK. I suggest adding the |
f5fb1bc to
8b4c5ba
Compare
8b4c5ba to
561e375
Compare
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
|
@laanwj @practicalswift thank you for your reviews. |
|
utACK 561e375 |
src/init.cpp
Outdated
| } | ||
|
|
||
| #ifndef WIN32 | ||
| NODISCARD static bool CreatePidFile() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're moving this function anyway, why not move GetPidFile as well, it's only used from init.cpp too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
Tested:
Looks good to me. |
It is only used from init.cpp. Move-only refactoring.
|
@laanwj's #15278 (comment) has been addressed. |
|
utACK 3782075 |
3782075 Move all PID file stuff to init.cpp (Hennadii Stepanov) 561e375 Make PID file creating errors fatal (Hennadii Stepanov) 745a2ac Improve PID file removing errors logging (Hennadii Stepanov) Pull request description: Digging into #15240 the lack of the proper logging has been discovered. Fixed by this PR. UPDATE (inspired by @laanwj's [comment](#15278 (comment))): Not being able to create the PID file is fatal now. Output of `bitcoind`: ``` $ src/bitcoind -pid=/run/bitcoind/bitcoind.pid 2019-02-01T23:20:10Z Bitcoin Core version v0.17.99.0-561e375c7 (release build) 2019-02-01T23:20:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures. 2019-02-01T23:20:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463 2019-02-01T23:20:10Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation 2019-02-01T23:20:10Z Using RdRand as an additional entropy source 2019-02-01T23:20:11Z Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory 2019-02-01T23:20:11Z Shutdown: In progress... 2019-02-01T23:20:11Z Shutdown: Unable to remove PID file: File does not exist 2019-02-01T23:20:11Z Shutdown: done ``` Output of `bitcoin-qt`:  **Notes for reviewers** 1. `CreatePidFile()` has been moved from `util/system.cpp` to `init.cpp` for the following reasons: - to get the ability to use `InitError()` - now `init.cpp` contains code of both creating PID file and removing it 2. Regarding 0.18 release process: this PR modifies 1 string and introduces 2 new ones. Tree-SHA512: ac07d0f800e61ec759e427d0afc0ca43d67f232e977662253963afdd0a220d34b871050f58149fc9fabd427bfc8e0d3f6a6032f2a38f30ad366fc0d074b0f2b3
Summary: * Improve PID file removing errors logging * Make PID file creating errors fatal * Move all PID file stuff to init.cpp It is only used from init.cpp. Move-only refactoring. This is a backport of Core [[bitcoin/bitcoin#15278 | PR15278]] The linter was skipped because we don't have that linter. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5775
Summary: * Improve PID file removing errors logging * Make PID file creating errors fatal * Move all PID file stuff to init.cpp It is only used from init.cpp. Move-only refactoring. This is a backport of Core [[bitcoin/bitcoin#15278 | PR15278]] The linter was skipped because we don't have that linter. Test Plan: ninja all check-all Reviewers: #bitcoin_abc, Fabien Reviewed By: #bitcoin_abc, Fabien Differential Revision: https://reviews.bitcoinabc.org/D5775
3782075 Move all PID file stuff to init.cpp (Hennadii Stepanov) 561e375 Make PID file creating errors fatal (Hennadii Stepanov) 745a2ac Improve PID file removing errors logging (Hennadii Stepanov) Pull request description: Digging into bitcoin#15240 the lack of the proper logging has been discovered. Fixed by this PR. UPDATE (inspired by @laanwj's [comment](bitcoin#15278 (comment))): Not being able to create the PID file is fatal now. Output of `bitcoind`: ``` $ src/bitcoind -pid=/run/bitcoind/bitcoind.pid 2019-02-01T23:20:10Z Bitcoin Core version v0.17.99.0-561e375c7 (release build) 2019-02-01T23:20:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures. 2019-02-01T23:20:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463 2019-02-01T23:20:10Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation 2019-02-01T23:20:10Z Using RdRand as an additional entropy source 2019-02-01T23:20:11Z Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory 2019-02-01T23:20:11Z Shutdown: In progress... 2019-02-01T23:20:11Z Shutdown: Unable to remove PID file: File does not exist 2019-02-01T23:20:11Z Shutdown: done ``` Output of `bitcoin-qt`:  **Notes for reviewers** 1. `CreatePidFile()` has been moved from `util/system.cpp` to `init.cpp` for the following reasons: - to get the ability to use `InitError()` - now `init.cpp` contains code of both creating PID file and removing it 2. Regarding 0.18 release process: this PR modifies 1 string and introduces 2 new ones. Tree-SHA512: ac07d0f800e61ec759e427d0afc0ca43d67f232e977662253963afdd0a220d34b871050f58149fc9fabd427bfc8e0d3f6a6032f2a38f30ad366fc0d074b0f2b3 Signed-off-by: pasta <[email protected]>
3782075 Move all PID file stuff to init.cpp (Hennadii Stepanov) 561e375 Make PID file creating errors fatal (Hennadii Stepanov) 745a2ac Improve PID file removing errors logging (Hennadii Stepanov) Pull request description: Digging into bitcoin#15240 the lack of the proper logging has been discovered. Fixed by this PR. UPDATE (inspired by @laanwj's [comment](bitcoin#15278 (comment))): Not being able to create the PID file is fatal now. Output of `bitcoind`: ``` $ src/bitcoind -pid=/run/bitcoind/bitcoind.pid 2019-02-01T23:20:10Z Bitcoin Core version v0.17.99.0-561e375c7 (release build) 2019-02-01T23:20:10Z Assuming ancestors of block 0000000000000037a8cd3e06cd5edbfe9dd1dbcc5dacab279376ef7cfc2b4c75 have valid signatures. 2019-02-01T23:20:10Z Setting nMinimumChainWork=00000000000000000000000000000000000000000000007dbe94253893cbd463 2019-02-01T23:20:10Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation 2019-02-01T23:20:10Z Using RdRand as an additional entropy source 2019-02-01T23:20:11Z Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory Error: Unable to create the PID file '/run/bitcoind/bitcoind.pid': No such file or directory 2019-02-01T23:20:11Z Shutdown: In progress... 2019-02-01T23:20:11Z Shutdown: Unable to remove PID file: File does not exist 2019-02-01T23:20:11Z Shutdown: done ``` Output of `bitcoin-qt`:  **Notes for reviewers** 1. `CreatePidFile()` has been moved from `util/system.cpp` to `init.cpp` for the following reasons: - to get the ability to use `InitError()` - now `init.cpp` contains code of both creating PID file and removing it 2. Regarding 0.18 release process: this PR modifies 1 string and introduces 2 new ones. Tree-SHA512: ac07d0f800e61ec759e427d0afc0ca43d67f232e977662253963afdd0a220d34b871050f58149fc9fabd427bfc8e0d3f6a6032f2a38f30ad366fc0d074b0f2b3 Merge bitcoin#15278: Improve PID file error handling
Digging into #15240 the lack of the proper logging has been discovered.
Fixed by this PR.
UPDATE (inspired by @laanwj's comment):
Not being able to create the PID file is fatal now.
Output of
bitcoind:Output of

bitcoin-qt:Notes for reviewers
CreatePidFile()has been moved fromutil/system.cpptoinit.cppfor the following reasons:InitError()init.cppcontains code of both creating PID file and removing it