-
Notifications
You must be signed in to change notification settings - Fork 41
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
Bug/skaled 1623 sigterm at exit #1695
Conversation
SUGGESTIONS BEFORE MERGE:
|
Probably, let's wait for "stable" - it will integrate changes in develop into v3.18.0 - and this PR would not be so bloated |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## v3.18.0 #1695 +/- ##
===========================================
+ Coverage 37.54% 45.29% +7.75%
===========================================
Files 349 351 +2
Lines 51408 51475 +67
===========================================
+ Hits 19301 23316 +4015
+ Misses 32107 28159 -3948 |
libdevcore/Common.cpp
Outdated
std::string strMessagePrefix; | ||
if ( nSignalNo > 0 ) { | ||
strMessagePrefix = ( ExitHandler::shouldExit() && s_nStopSignal > 0 ) ? | ||
cc::error( "\nStop flag was already raised on. " ) + |
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.
Please remove color comments
libdevcore/Common.cpp
Outdated
strMessagePrefix = ExitHandler::shouldExit() ? | ||
cc::error( "\nInternal exit requested while already exiting. " ) : | ||
cc::error( "\nInternal exit initiated. " ); | ||
} | ||
std::cerr << strMessagePrefix << cc::error( skutils::signal::signal2str( nSignalNo ) ) | ||
<< "\n\n"; | ||
std::cerr.flush(); |
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.
Remove this line since cerr is always flushed on line end
@@ -153,7 +160,8 @@ void ExitHandler::exitHandler( int nSignalNo, ExitHandler::exit_code_t ec ) { | |||
|
|||
// nice exit here: | |||
|
|||
if ( ExitHandler::shouldExit() ) { | |||
// TODO deduplicate with first if() | |||
if ( ExitHandler::shouldExit() && s_nStopSignal > 0 && nSignalNo > 0 ) { | |||
std::cerr << ( "\n" + cc::fatal( "SIGNAL-HANDLER:" ) + " " + | |||
cc::error( "Will force exit now..." ) + "\n\n" ); | |||
_exit( 13 ); |
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.
Why is 13 used here ? Is there a document in which error codes are defined?
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.
Approved, next steps:
- Need to add test to functional-tests
- Fix colorization
- Test build on devnet
UPD Currently, functional tests fail in load_js. But fail happens because of skaled JSON-RPC request refusal. As changes in this PR cannot affect JSON-RPC at all - most probably, issue is because of Debug build instead of Release build. It should be gone after merge and Release build. |
When skaled is shutting down by internal cause, it counts this event as though it was external SIGTERM. This leads to forced shutdown if real SIGTERM is received during shutdown procedure. Need not to count internal exit request as SIGTERM.
Test https://github.com/skalenetwork/skale-node-tests/blob/master/test_stop.py#L252