当前位置:网站首页>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); }
边栏推荐
- Why do you get confused when you ask JVM?
- (干货)结合Scikit-learn介绍几种常用的特征选择方法
- 界面设计四大原则
- Exch:POP3 和 IMAP4 操作指南
- R语言使用ggpubr包的ggarrange函数将多幅图像组合起来、使用ggexport函数将可视化图像保存为bmp格式(width参数指定宽度、height参数指定高度、res参数指定分辨率)
- R语言ggplot2可视化:使用ggplot2可视化散点图、使用ggpubr包的theme_classic2函数设置可视化图像为经典主题(classic theme with axis lines)
- 测试如何应对新的开发模式?
- 基于自学习的机器人决策系统(达闼科技赵开勇)
- DHCP:在网络中防止 Rogue DHCP Server
- 解密:智能化变电站中PTP时钟同步(北斗时钟服务器)
猜你喜欢
![[machine learning] Wu Enda: lifelong learning](/img/f2/a729c026ed55506e63878d0d317676.jpg)
[machine learning] Wu Enda: lifelong learning

界面设计四大原则

PC performance monitoring tool is an indispensable helper for software testers

As a background developer, you must know two kinds of filters

固态硬盘的工作原理揭秘

简历上写的电商,那请问Redis 如何实现库存扣减操作和防止被超卖?

Todo fix bug tag feature and other configurations

树莓派3b串口登录前准备工作

According to the e-commerce written on the resume, how does redis realize inventory deduction and prevent oversold?

(CVPR-2022)BiCnet
随机推荐
PowerCLi 管理VMware vCenter 一键批量部署OVF
一道题目初探组合数学与DP关系,可重集组合公式推导
PowerCLi 管理VMware vCenter 一键批量部署OVA
Usage of formatdatetime
(dry goods) introduce several common feature selection methods combined with scikit learn
PC performance monitoring tool is an indispensable helper for software testers
【leetcode天梯】链表 · 206 反转链表
Weights & biases (I)
Mee | Zhejiang University Chenglei group develops a new method for designing and constructing synthetic flora
基于自学习的机器人决策系统(达闼科技赵开勇)
为啥一问 JVM 就 懵B ?
什么是弱网测试?为什么要进行弱网测试?怎么进行弱网测试?「建议收藏」
Type-C Bluetooth speaker single C-Port rechargeable OTG solution
使用 frp 实现内网穿透
GPS北斗时钟服务器(NTP网络时钟系统)施工部署方案
DHCP:在网络中防止 Rogue DHCP Server
Socat uses "suggestions collection"
四旋翼飞行器1——结构和控制原理
AtCoder Regular Contest 144【VP记录】
有向图之求两点之间所有路径