-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
node: Respond always to OS interrupts #2479
Conversation
even during genesis sleep by setting up interrupt before starting a node Refs #2434
to avoid ``` E[09-24|10:13:15.805] Not stopping PubSub -- have not been started yet module=pubsub impl=PubSub ``` being printed on exit
Codecov Report
@@ Coverage Diff @@
## develop #2479 +/- ##
===========================================
- Coverage 61.7% 61.68% -0.02%
===========================================
Files 198 198
Lines 16358 16364 +6
===========================================
+ Hits 10093 10094 +1
- Misses 5438 5443 +5
Partials 827 827
|
@@ -207,7 +207,11 @@ func (mt *MultiplexTransport) Dial( | |||
func (mt *MultiplexTransport) Close() error { | |||
close(mt.closec) | |||
|
|||
return mt.listener.Close() | |||
if mt.listener != nil { |
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.
Is this to not panic when Close
is called before Listen
? When does that happen?
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.
Yes. There's a problem with the current common#Service implementation where it considers a service started before OnStart() finishes.
tendermint/libs/common/service.go
Lines 131 to 139 in 0c9c329
if atomic.CompareAndSwapUint32(&bs.started, 0, 1) { | |
if atomic.LoadUint32(&bs.stopped) == 1 { | |
bs.Logger.Error(fmt.Sprintf("Not starting %v -- already stopped", bs.name), "impl", bs.impl) | |
// revert flag | |
atomic.StoreUint32(&bs.started, 0) | |
return ErrAlreadyStopped | |
} | |
bs.Logger.Info(fmt.Sprintf("Starting %v", bs.name), "impl", bs.impl) | |
err := bs.impl.OnStart() |
Therefore, calling IsRunning() can return true even though the service is not yet started (or partially started)
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.
👍 🍡
Simpler, faster, stronger!
Refs #2434
Updated all relevant documentation in docsUpdated all code comments where relevantWrote tests