Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
925 views
in Technique[技术] by (71.8m points)

crash - Debugging Python Fatal Error: 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.

OS : Linux.

  • Is there a proper way to debug this issue.

There were couple of suggestions in the following article. Python memory debugging with GDB

Not sure which approach worked for the author.

  • Is there a way to generate memory dumps in such scenario which could be analyzed. Like in Windows world.

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/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

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.

This usually worked fine but when multiple threads did the same action concurrently it resulted in the Crash with 'GC Object already tracked'.

Synchronizing the access to python objects for multiple thread does resolve this issue.

Thanks to any responded to this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...