Best practices for recovering from a segmentation fault(从分段错误中恢复的最佳实践)
问题描述
我正在开发一个用 C++ 编写的多线程进程,并且正在考虑使用 google 修改 SIGSEGV 处理-coredumper 在发生分段错误时保持进程处于活动状态.
I am working on a multithreaded process written in C++, and am considering modifying SIGSEGV handling using google-coredumper to keep the process alive when a segmentation fault occurs.
但是,除非我以某种方式重新初始化可能导致核心转储的线程和对象,否则 google-coredumper 的这种使用似乎已经成熟,有机会陷入核心转储的无限循环.
However, this use of google-coredumper seems ripe with opportunities to get stuck in an infinite loop of core dumps unless I somehow reinitialize the thread and the object that may have caused the core dump.
在尝试通过核心转储保持进程活动时,我应该牢记哪些最佳做法?我还应该注意哪些其他陷阱"?
What best practices should I keep in mind when trying to keep a process alive through a core dump? What other 'gotchas' should I be aware of?
谢谢!
推荐答案
最佳实践是修复导致核心转储的原始问题,重新编译然后重新启动应用程序.
The best practice is to fix the original issue causing the core dump, recompile and then relaunch the application.
要在实际部署之前发现这些错误,请进行大量同行评审并编写大量测试.
To catch these errors before deploying in the wild, do plenty of peer review and write lots of tests.
这篇关于从分段错误中恢复的最佳实践的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从分段错误中恢复的最佳实践


- 一起使用 MPI 和 OpenCV 时出现分段错误 2022-01-01
- 如何对自定义类的向量使用std::find()? 2022-11-07
- 静态初始化顺序失败 2022-01-01
- STL 中有 dereference_iterator 吗? 2022-01-01
- C++ 协变模板 2021-01-01
- 从python回调到c++的选项 2022-11-16
- 使用/clr 时出现 LNK2022 错误 2022-01-01
- 与 int by int 相比,为什么执行 float by float 矩阵乘法更快? 2021-01-01
- 近似搜索的工作原理 2021-01-01
- Stroustrup 的 Simple_window.h 2022-01-01