Shutdown Gracefully on Kill or Interrupt. #327
Conversation
In fact, I prefer |
It still generally closes in less than 1 second. It is a best practice to shutdown cleanly. |
I also like this, Erik...hauajaha But I think @jsolman wants to avoid crashes. |
@erikzhang |
@shargon I was looking for the best way to do it. I haven’t found a trivial way yet since we don’t have a top level actor. |
I’ll see if I can find a way to get rid of them also in this PR after I finish the consensus PR I’m working on now |
I think that maybe this patch can come to neo-cli 3.0, however, let's not modify 2.x. Is there something else to be done here, @jsolman? @erikzhang, I also prefer ctrl+c to kill direct. However, in the last core developers meeting I think that the majority agreed that we should avoid crashes...aehauhuea |
There is no reason this should not be on both branches IMO. |
neo-cli 2.x can historically stay with its behavior, this will not really impact in anything critical. However, it may be a good practice for Neo 3, if the majority agrees. |
conflicts |
Hi @jsolman, could you solve the conflicts? Do you want us to solve it for you? |
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.
My review at #428
@vncoelho does this work well for you in linux? |
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.
@shargon, with this PR the ctrl +c
is working on linux. Looks good
@vncoelho with my patch is working too? |
Thanks for rebasing. |
I did not test yet, @shargon. I want to finish the P2P...aheuahueaea |
@shargon, In fact, ctrl+c has been always working on linux. I still need to test the patch you opened. But is this an agreement that this change is good? |
@shargon, @jsolman and @erikzhang, This works nice and ok with However, if the client is still killed very fast (just after initialization), this error is still obtained: [ERROR][08/19/2019 19:37:29][Thread 0004][akka://NeoSystem/system/IO-TCP/$a] Monitored actor [[akka://NeoSystem/user/$b#1681348270]] terminated
Cause: Akka.Actor.DeathPactException: Monitored actor [[akka://NeoSystem/user/$b#1681348270]] terminated
at Akka.Actor.ActorBase.Unhandled(Object message)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.ReceiveMessage(Object message)
at Akka.Actor.ActorCell.AutoReceiveMessage(Envelope envelope)
at Akka.Actor.ActorCell.Invoke(Envelope envelope) |
In my windows works well, but this exceptions is something to fix in other PR, i think |
@shargon, I prefer to wait for @erikzhang or @superboyiii approval. |
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.
It fixes the control+c problem, thanks.
It prints some messages but I think they are ok.
On my windows machine, without this, control-c makes neo-cli unresponsive.
That is why I did not want to merge it and told to wait for @erikzhang and @superboyiii review's. |
The red messages on Akka are just notifying the actors shutdown. A different top level actor needs to be added to avoid them. I have run this on Linux a long time and never saw the hang you are describing @vncoelho. What are the steps you are using to reproduce the hang? What hardware are you running on? What flavor of Linux? |
With this PR Interrupt due to
Control+C
or process kill will properly be caught and cause the node to be stopped in the same way as typingexit
.