调试Python致命错误:GC对象已被跟踪 [英] Debugging Python Fatal Error: GC Object already Tracked

查看:5417
本文介绍了调试Python致命错误:GC对象已被跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的python代码已经崩溃,错误'GC对象已经跟踪'。尝试找出调试此崩溃的最佳方法。

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和Core转储来调试这个问题。

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.

这通常可以正常工作,但是当多个线程同时执行相同的动作时,会导致Crash with'GC Object already tracked'。

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对象已被跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆