hived signal handling issues with redirected output
hived improperly handles Ctrl+C (SIGINT) in certain situations
scenarios
working example:
just run hived
and hit Ctrl+C
^CBefore shutting down...
2021-05-21T10:49:19.794165 p2p_plugin.cpp:682 plugin_pre_shutdown ] Shutting down P2P Plugin
2021-05-21T10:49:19.794209 p2p_plugin.cpp:687 plugin_pre_shutdown ] P2P Plugin: checking handle_block and handle_transaction activity
2021-05-21T10:49:19.795678 p2p_plugin.cpp:691 plugin_pre_shutdown ] Waiting for p2p_thread quit
2021-05-21T10:49:19.795714 p2p_plugin.cpp:693 plugin_pre_shutdown ] p2p_thread quit done
Shutting down...
2021-05-21T10:49:19.803988 webserver_plugin.cpp:207 operator() ] ws io service exit
2021-05-21T10:49:19.804038 webserver_plugin.cpp:235 operator() ] http io service exit
2021-05-21T10:49:19.804460 state_snapshot_plugin.cpp:1394 plugin_shutdown ] Shutting down account_history_rocksdb_plugin...
2021-05-21T10:49:19.804505 account_history_rocksdb_plugin.cpp:2296 plugin_shutdown ] Shutting down account_history_rocksdb_plugin...
2021-05-21T10:49:20.102452 chain_plugin.cpp:767 plugin_shutdown ] closing chain database
2021-05-21T10:49:20.102467 chain_plugin.cpp:366 stop_write_processin ] Waiting for write processing thread finish...
2021-05-21T10:49:20.109006 chain_plugin.cpp:356 operator() ] Write processing thread finished.
2021-05-21T10:49:20.109098 chain_plugin.cpp:368 stop_write_processin ] Write processing thread stopped.
2021-05-21T10:49:20.109108 database.cpp:441 close ] Closing database
2021-05-21T10:49:20.109554 database.cpp:452 close ] Database flushed at LIB: 54081533
2021-05-21T10:49:20.212749 database.cpp:460 close ] Database is closed
2021-05-21T10:49:20.212774 chain_plugin.cpp:770 plugin_shutdown ] database closed successfully
Leaving application main loop...
exited cleanly
gandalf@grey:~$ echo $?
0
failing example:
Pipe hived
output to tee
(without -i
) and hit Ctrl+C
2021-05-21T10:52:32.679450 p2p_plugin.cpp:682 plugin_pre_shutdown ] Shutting down P2P Plugin
2021-05-21T10:52:32.679506 p2p_plugin.cpp:687 plugin_pre_shutdown ] P2P Plugin: checking handle_block and handle_transaction activity
2021-05-21T10:52:32.680889 p2p_plugin.cpp:691 plugin_pre_shutdown ] Waiting for p2p_thread quit
2021-05-21T10:52:32.680919 p2p_plugin.cpp:693 plugin_pre_shutdown ] p2p_thread quit done
2021-05-21T10:52:32.688724 webserver_plugin.cpp:207 operator() ] ws io service exit
2021-05-21T10:52:32.688753 webserver_plugin.cpp:235 operator() ] http io service exit
2021-05-21T10:52:32.689238 state_snapshot_plugin.cpp:1394 plugin_shutdown ] Shutting down account_history_rocksdb_plugin...
2021-05-21T10:52:32.689287 account_history_rocksdb_plugin.cpp:2296 plugin_shutdown ] Shutting down account_history_rocksdb_plugin...
2021-05-21T10:52:32.957984 chain_plugin.cpp:767 plugin_shutdown ] closing chain database
2021-05-21T10:52:32.958005 chain_plugin.cpp:366 stop_write_processin ] Waiting for write processing thread finish...
2021-05-21T10:52:32.958628 chain_plugin.cpp:356 operator() ] Write processing thread finished.
2021-05-21T10:52:32.958687 chain_plugin.cpp:368 stop_write_processin ] Write processing thread stopped.
2021-05-21T10:52:32.958695 database.cpp:441 close ] Closing database
2021-05-21T10:52:32.958816 database.cpp:452 close ] Database flushed at LIB: 54081596
2021-05-21T10:52:33.079516 database.cpp:460 close ] Database is closed
2021-05-21T10:52:33.079529 chain_plugin.cpp:770 plugin_shutdown ] database closed successfully
gandalf@grey:~$ echo $?
130