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 对象


- 如何在 python3 中将 OrderedDict 转换为常规字典 2022-01-01
- 分析异常:路径不存在:dbfs:/databricks/python/lib/python3.7/site-packages/sampleFolder/data; 2022-01-01
- 使用Heroku上托管的Selenium登录Instagram时,找不到元素';用户名'; 2022-01-01
- 沿轴计算直方图 2022-01-01
- 如何在 Python 的元组列表中对每个元组中的第一个值求和? 2022-01-01
- python-m http.server 443--使用SSL? 2022-01-01
- python check_output 失败,退出状态为 1,但 Popen 适用于相同的命令 2022-01-01
- 如何将一个类的函数分成多个文件? 2022-01-01
- pytorch 中的自适应池是如何工作的? 2022-07-12
- padding='same' 转换为 PyTorch padding=# 2022-01-01