当前位置:网站首页>Safely stop NodeOS
Safely stop NodeOS
2022-07-23 19:37:00 【Falling wild geese in Pingsha】
problem
kill When the command is executed again, it will cause the following error .
pkill -9 nodeos or kill -9 {pid} database dirty flag set (likely due to unclean shutdown): replay required
When re running nodeos when , You have to use --replay-blockchain Command to rebuild system data .
test
Here is How do I stop nodeos gracefully? · Issue #4301 · EOSIO/eos · GitHub Stop of summary nodes Test results
This appears to be two different issues. Startup after a crash or ungraceful shutdown nearly always fails due to corruption of the boost shared memory cache of the in-memory database. --resync is required to clean up the mess. For normal shutdown, never kill with -9. Always use either the default (no argument) signal (which is SIGTERM) or SIGINT. Numerically, those are 15 and 2, respectively. pkill nodeos | Safe pkill -15 nodeos | Safe pkill -2 nodeos | Safe pkill -TERM nodeos | Safe pkill -SIGTERM nodeos | Safe pkill -INT nodeos | Safe pkill -SIGINT nodeos | Safe pkill -9 nodeos | Not Safe pkill -KILL nodeos | Not Safe pkill -SIGKILL nodeos | Not Safe The core dump is a different problem. That looks like a corrupted network packet, specifically a signed_block_summary. Summary messages are being eliminated from the protocol, so this particular error will no longer be possible soon.
summary
Simple command to safely stop the process :
pkill nodeos
Reference from :github
scene 2:docker
Safety method
- If nodeos The runner docker In container , According to the test above , You can know that the following methods are safe
docker kill -s SIGTERM [nodeos Container name ]
- docker exec pkill nodeos It's safe
docker kill -s SIGTEM Is reliable
By default ,docker kill The command does not give any... To applications in the container gracefully shutdown The opportunity of . It will send out directly SIGKILL System signal , To forcibly terminate the operation of the program in the container .
# docker kill --help Usage: docker kill [OPTIONS] CONTAINER [CONTAINER...] Kill one or more running containers Options: -s, --signal string Signal to send to the container (default "KILL")
But it can go through -s Options
docker kill -s Signal name 【 Container name 】 docker kill -s SIGTERM mycontainer
docker stop- unreliable
stay docker stop When the command is executed , Will first put into the container PID by 1 The process of sending system signals SIGTERM, Then wait for the application in the container to terminate execution , If the waiting time reaches the set timeout , Or by default 10 second , Will continue to send SIGKILL The system signal is forced kill Drop the process . Applications in containers , You can choose to ignore and not deal with SIGTERM The signal , But once the timeout is reached , The program will be forced by the system kill fall , because SIGKILL The signal is sent directly to the system kernel , The application has no chance to deal with it . In the use of docker stop When ordered , The only thing we can control is the timeout , For example, set to 20 Second timeout :
# docker stop --help Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...] Stop one or more running containers Options: -t, --time int Seconds to wait for stop before killing it (default 10)
-t: The time limit for closing the container , If the timeout fails to close, use kill closed , The default value is 10s, This time is used for the container's own saved state
docker restart
Closing phase and docker stop Machine style .
Source code analysis
stay eos Project documents \eos\libraries\appbase\application.cpp Can be seen in ,nodeos Can pass 3 A signal SIGINT, SIGTERM, SIGPIPE To safely close the program . We usually use SIGTERM Just fine .
void application::setup_signal_handling_on_ios(boost::asio::io_service& ios) { std::shared_ptr<boost::asio::signal_set> ss = std::make_shared<boost::asio::signal_set>(ios, SIGINT, SIGTERM, SIGPIPE); wait_for_signal(ss); }
边栏推荐
- Weights & biases (I)
- R语言使用dwilcox函数生成Wilcoxon秩和统计分布密度函数数据、使用plot函数可视化Wilcoxon秩和统计分布密度函数数据
- AE tutorial, how to animate illustrator layered documents in after effects?
- R语言使用quantile函数计算向量数据或者dataframe指定数据列的分位数(百分位数)
- redis过期key的删除策略[通俗易懂]
- J9数字论:数字行业的FOMO现象我们应该怎么克服?
- 二、MFC窗口和消息
- Calculation of structure size (structure memory alignment)
- Read data from txt and convert it to Yolo format data
- PowerCLi 将虚拟机从Host01主机移动到Host02主机
猜你喜欢
随机推荐
Tree learning summary
Canvas draw text and clear draw
ACM mm 2022 oral | dig: the new framework of self-monitoring character recognition refreshes the recognition performance of 11 public scene character data sets, with an average improvement of 5%
Still using xshell? You are out. I recommend a more modern terminal connection tool
Mysql database [Database Foundation -- introduction]
总结一些最近见到的 TRICK
Why are there Chinese materials and web pages for foreign chips?
虹科干货 | 教您如何解析MODBUS中的浮点型数据
Summarize some recent tricks
公链之Sui(前脸书/Meta员工成立的新公链项目)
移动语义和完美转发浅析
关于:在企业局域网中启用 Delivery Optimization
What are offline data and real-time data
Tuple error caused by different regularization
Alibaba最新神作!耗时187天肝出来1015页分布式全栈手册太香了
Educational Codeforces Round 132 (Rated for Div. 2)【比赛记录】
Solutions to SecureCRT garbled code problem [easy to understand]
Type-C蓝牙音箱单C口可充电可OTG方案
Element positioning in selenium is correct, but the operation fails. Six solutions are all finalized
时代潮头,华为将风帆对准数字金融的风与海








