Open linh2931 opened 1 month ago
What state would you expect the node to be in if interrupted by ctrl-c while loading the snapshot?
Just delete everything and put up a big warning before quitting. Otherwise the user has to wait for a long time if loading a big snapshot.
We cannot shutdown in the middle of snapshot loading and leave nodeos in a good state. And we do not want Ctrl-C to leave nodeos in a bad state; there is already kill -9
if you want to kill the process immediately regardless of what state it leaves it state files.
So the most we can do for this issue is to change the log message reported in reaction to Ctrl-C.
Right now it prints the message "appbase quit called".
One simple thing we can do is to just change this message to the more helpful "Shutdown pending".
Another thing we can do in addition to that is to detect the context we are in (in the middle of snapshot loading, for example) and based on that clarify to the user that nodeos will shutdown after, for example, snapshot initialization completes which may take a long time.
hi!
Tell me how to start a node from a snapshot if after starting the node it starts synchronization and it is impossible to terminate the node correctly! the database crashes.
I start it like this: nodeos --data-dir ./blockchain --config-dir ./blockchain --snapshot $SNAP_DIR/snapshot.bin
When syncing you have to be very patient with ctrl-c or SIGTERM/SIGINT to stop a node.
See https://github.com/AntelopeIO/spring/issues/284 and https://github.com/AntelopeIO/spring/issues/527
When syncing get_info
can take seconds/minutes to respond.
When syncing ctrl-c can take seconds/minutes to respond. For example, I just ctrl-c a node that was syncing to EOS Mainnet and it took 9 minutes for it to shutdown.
I tried to stop loading snapshot by CTRL-C but failed. The loading kept going until finished, and then nodeos exited due to the earlier CTRL-C: