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

[TRIVIAL] Improve reporting of missing node exceptions #3351

Closed
wants to merge 3 commits into from
Closed

[TRIVIAL] Improve reporting of missing node exceptions #3351

wants to merge 3 commits into from

Conversation

nbougalis
Copy link
Contributor

No description provided.

: std::runtime_error ("SHAMapMissingNode")
, mType (t)
, mNodeHash (nodeHash)
SHAMapMissingNode (SHAMapType t, SHAMapHash const& hash)
Copy link
Collaborator

@seelabs seelabs Apr 13, 2020

Choose a reason for hiding this comment

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

What do you think of adding the stack trace to the message when in debug mode? (here and the other constructors)

Copy link
Contributor Author

@nbougalis nbougalis Apr 13, 2020

Choose a reason for hiding this comment

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

I thought about doing this in LogThrow actually. My primary concern is that capturing a call stack is expensive to do everytime we call Throw even in debug mode. Perhaps a special config and/or runtime option?

@HowardHinnant: is it reasonable to use std::set_terminate to attempt to print a call stack from the termination handler? The actual call-stack displayed will depend on how the underlying system handles stack unwinding, so collecting the stack from there may not be helpful.

Copy link
Contributor

Choose a reason for hiding this comment

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

On Mac and Linux, the existing terminate handler creates a very good stack dump. I think we used to have a custom terminate handlers and got rid of them in order to improve our stack dumps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The question is where do we get the usable stack dumps from? I know on Mac you can get them in the log, but what about Linux?

Copy link
Contributor

Choose a reason for hiding this comment

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

As not-a-Linux-user, I don't know. I thought we had that knowledge within the rippled team though. We used to get them mailed to us whenever a production server went down (hasn't happened in awhile).

Perhaps I'm misunderstanding this thread...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was caused by a script we were running on production servers ran by Ripple that would detect the crash and automatically ran gdb on the resulting core file. The question is what happens if there is no core file? On the Mac we do get a very pretty call stack in the logs. We'll have to research what happens on Linux.

@@ -830,7 +830,7 @@ RCLConsensus::timerEntry(NetClock::time_point const& now)
catch (SHAMapMissingNode const& mn)
{
// This should never happen
JLOG(j_.error()) << "Missing node during consensus process " << mn;
JLOG(j_.error()) << "During consensus process: " << mn.what();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't need the .what() (here and below) if you're still defining the stream operator (it still used in other places in the code).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking of just removing the << and printing what() instead. Not sure if that's better.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I look at the stream operator<< as the C++ version of __str__ in Python or Show in Haskell, generally considered good practice, so I like it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmmm. That seems reasonable.

HowardHinnant
HowardHinnant previously approved these changes Apr 13, 2020
Copy link
Contributor

@HowardHinnant HowardHinnant left a comment

Choose a reason for hiding this comment

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

Nice simplification!

@codecov-io
Copy link

Codecov Report

Merging #3351 into develop will increase coverage by 0.01%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3351      +/-   ##
===========================================
+ Coverage    70.46%   70.48%   +0.01%     
===========================================
  Files          684      683       -1     
  Lines        55001    54995       -6     
===========================================
+ Hits         38759    38762       +3     
+ Misses       16242    16233       -9     
Impacted Files Coverage Δ
src/ripple/app/consensus/RCLConsensus.cpp 59.17% <0.00%> (ø)
src/ripple/app/ledger/Ledger.cpp 79.26% <0.00%> (ø)
src/ripple/app/ledger/OrderBookDB.cpp 81.56% <0.00%> (ø)
src/ripple/app/ledger/impl/LedgerCleaner.cpp 21.05% <0.00%> (ø)
src/ripple/app/ledger/impl/LedgerMaster.cpp 41.64% <0.00%> (ø)
src/ripple/app/main/Application.cpp 59.93% <0.00%> (-0.07%) ⬇️
src/ripple/rpc/impl/RPCHelpers.cpp 86.74% <0.00%> (+0.23%) ⬆️
src/ripple/shamap/SHAMapMissingNode.h 0.00% <0.00%> (ø)
src/ripple/basics/DecayingSample.h 86.48% <0.00%> (+8.10%) ⬆️

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 4f422f6...4d960af. Read the comment docs.

Copy link
Collaborator

@seelabs seelabs left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@nbougalis nbougalis mentioned this pull request Apr 15, 2020
@carlhua carlhua added the Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required. label Apr 15, 2020
@nbougalis nbougalis deleted the smn branch October 16, 2023 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Passed Passed code review & PR owner thinks it's ready to merge. Perf sign-off may still be required.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants