Debugging Python Fatal Error: GC Object already Tracked(调试 Python 致命错误:已跟踪 GC 对象)
问题描述
我的 python 代码因错误 'GC Object already Tracked' 而崩溃.试图找出调试此崩溃的最佳方法.
My python code has been crashing with error 'GC Object already Tracked' . Trying to figure out the best approach to debug this crashes.
操作系统:Linux.
OS : Linux.
- 是否有适当的方法来调试此问题.
在下面的文章中有几个建议.使用 GDB 进行 Python 内存调试
There were couple of suggestions in the following article. Python memory debugging with GDB
不确定哪种方法对作者有效.
Not sure which approach worked for the author.
- 有没有办法在这种情况下生成可以分析的内存转储.就像在 Windows 世界中一样.
找到了一些关于此的文章.但不能完全回答我的问题:http://pfigue.github.io/blog/2012/12/28/where-is-my-core-dump-archlinux/
Found some article on this. But not entirely answers my question: http://pfigue.github.io/blog/2012/12/28/where-is-my-core-dump-archlinux/
推荐答案
在我的场景中找到了这个问题的原因(不一定是GC对象崩溃的唯一原因).我使用 GDB 和核心转储来调试这个问题.
Found out the reason for this issue in my scenario (not necessarily the only reason for the GC object crash). I used the GDB and Core dumps to debug this issue.
我有 Python 和 C 扩展代码(在共享对象中).Python 代码使用 C 扩展代码注册回调例程.在某个工作流中,来自 C 扩展代码的线程正在调用 Python 代码中注册的回调例程.
I have Python and C Extension Code (in shared object). Python code registers a Callback routine with C Extension code. In a certain workflow a thread from C Extension code was calling the registered Call back routine in Python code.
这通常工作得很好,但是当多个线程同时执行相同的操作时,它会导致崩溃并显示GC 对象已被跟踪".
This usually worked fine but when multiple threads did the same action concurrently it resulted in the Crash with 'GC Object already tracked'.
同步多个线程对 python 对象的访问确实解决了这个问题.
Synchronizing the access to python objects for multiple thread does resolve this issue.
感谢任何对此的回应.
这篇关于调试 Python 致命错误:已跟踪 GC 对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:调试 Python 致命错误:已跟踪 GC 对象


基础教程推荐
- 如何在Python中绘制多元函数? 2022-01-01
- 使用 Google App Engine (Python) 将文件上传到 Google Cloud Storage 2022-01-01
- 使用Python匹配Stata加权xtil命令的确定方法? 2022-01-01
- Python 的 List 是如何实现的? 2022-01-01
- 哪些 Python 包提供独立的事件系统? 2022-01-01
- 使 Python 脚本在 Windows 上运行而不指定“.py";延期 2022-01-01
- 症状类型错误:无法确定关系的真值 2022-01-01
- 合并具有多索引的两个数据帧 2022-01-01
- 将 YAML 文件转换为 python dict 2022-01-01
- 如何在 Python 中检测文件是否为二进制(非文本)文 2022-01-01