且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

进程以退出代码 139 结束(被信号 11 中断:SIGSEGV)

更新时间:2021-08-21 04:35:03

SIGSEGV 信号指示分段违规"或段错误".或多或少,这相当于读取或写入未在进程中映射的内存地址.

The SIGSEGV signal indicates a "segmentation violation" or a "segfault". More or less, this equates to a read or write of a memory address that's not mapped in the process.

这表明您的程序中存在错误.在 Python 程序中,这要么是解释器中的错误,要么是正在使用的扩展模块中的错误(后者是最常见的原因).

This indicates a bug in your program. In a Python program, this is either a bug in the interpreter or in an extension module being used (and the latter is the most common cause).

要解决此问题,您有多种选择.一种选择是生成一个最小的、独立的、完整的示例来复制问题,然后将其作为错误报告提交给它使用的扩展模块的维护者.

To fix the problem, you have several options. One option is to produce a minimal, self-contained, complete example which replicates the problem and then submit it as a bug report to the maintainers of the extension module it uses.

另一种选择是尝试自己找出原因.gdb 是一个有价值的工具,Python 的调试版本和所有正在使用的扩展模块.

Another option is to try to track down the cause yourself. gdb is a valuable tool in such an endeavor, as is a debug build of Python and all of the extension modules in use.

安装 gdb 后,您可以使用它来运行您的 Python 程序:

After you have gdb installed, you can use it to run your Python program:

gdb --args python <more args if you want>

然后使用 gdb 命令来追踪问题.如果您使用 run,那么您的程序将一直运行到崩溃为止,您将有机会使用其他 gdb 命令检查状态.

And then use gdb commands to track down the problem. If you use run then your program will run until it would have crashed and you will have a chance to inspect the state using other gdb commands.