当前位置:网站首页>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); }
边栏推荐
- 二、MFC窗口和消息
- Why are there Chinese materials and web pages for foreign chips?
- SecureCRT乱码问题解决方法[通俗易懂]
- redis过期key的删除策略[通俗易懂]
- What are offline data and real-time data
- Todo fix bug tag feature and other configurations
- (CVPR-2022)BiCnet
- (干货)结合Scikit-learn介绍几种常用的特征选择方法
- 【leetcode天梯】链表 · 206 反转链表
- Type-C蓝牙音箱单C口可充电可OTG方案
猜你喜欢

There is great competition pressure for software testing jobs, and the "migrant workers" who graduated from 985 also suffer

When does MySQL use table locks and row locks?

MySQL数据库【数据库基础--引入篇】

Todo fix bug tag feature and other configurations

H7-TOOL的CANFD/CAN接口脱机烧写操作说明, 已经更新(2022-07-12)

记一次被网络诈骗的经历

【leetcode天梯】链表 · 206 反转链表

《自适应机器人交互白皮书》

看完这篇,彻底搞懂 gRPC!

AtCoder Regular Contest 144【VP记录】
随机推荐
Sui of the public chain (New Public chain project established by former Facebook /meta employees)
总结一些最近见到的 TRICK
What is weak network testing? Why should weak network test be carried out? How to conduct weak network test? "Suggested collection"
H7-TOOL串口脱机烧录操作说明,支持TTL串口,RS232和RS485(2022-06-30)
USB3.0: layout guide for vl817q7-c0
canvas绘制文本和清除绘制
二叉树高度 [log2n]+1与log2(n+1)是否相等
R语言ggpubr包的ggarrange函数多幅图像组合起来、annotate_figure组合图像添加注释、注解、标注信息、使用top参数在可视化图像顶部添加注解信息(自定义字体颜色、大小、样式)
Type-C Bluetooth speaker single C-Port rechargeable OTG solution
elk笔记25--快速体验APM
not all arguments converted during string formatting
DHCP:在网络中防止 Rogue DHCP Server
Atcoder regular contest 144 [VP record]
三维点云课程(六)——三维目标检测
公链之Sui(前脸书/Meta员工成立的新公链项目)
Why are there Chinese materials and web pages for foreign chips?
Alibaba's latest masterpiece! It took 187 days for the liver to come out. 1015 pages of distributed full stack manuals are so delicious
三维点云课程(七)——特征点描述
Brief analysis of compiling principle of.Net CLR R2R
PowerCLi 管理VMware vCenter 一键批量部署OVF