Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17432

Debugging a difficult refcount issue.

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From buck <workitharder@gmail.com>
Newsgroups comp.lang.python
Subject Debugging a difficult refcount issue.
Date Sat, 17 Dec 2011 20:17:35 -0800 (PST)
Organization http://groups.google.com
Lines 23
Message-ID <18365650.792.1324181855929.JavaMail.geo-discussion-forums@prht13> (permalink)
Reply-To comp.lang.python@googlegroups.com
NNTP-Posting-Host 98.248.112.191
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-Trace posting.google.com 1324181942 25955 127.0.0.1 (18 Dec 2011 04:19:02 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Sun, 18 Dec 2011 04:19:02 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=98.248.112.191; posting-account=_aPj8woAAAA9KMWxfZbAmBu6pRusF4_6
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17432

Show key headers only | View raw


I'm getting a fatal python error "Fatal Python error: GC object already tracked"[1].

Using gdb, I've pinpointed the place where the error is detected. It is an empty dictionary which is marked as in-use. This is somewhat helpful since I can reliably find the memory address of the dict, but it does not help me pinpoint the issue. I was able to find the piece of code that allocates the problematic dict via a malloc/LD_PRELOAD interposer, but that code was pure python. I don't think it was the cause.

I believe that the dict was deallocated, cached, and re-allocated via PyDict_New to a C routine with bad refcount logic, then the above error manifests when the dict is again deallocated, cached, and re-allocated.

I tried to pinpoint this intermediate allocation with a similar PyDict_New/LD_PRELOAD interposer, but that isn't working for me[2].

How should I go about debugging this further? I've been completely stuck on this for two days now :(

[1] http://hg.python.org/cpython/file/99af4b44e7e4/Include/objimpl.h#l267
[2] http://stackoverflow.com/questions/8549671/cant-intercept-pydict-new-with-ld-preload

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Debugging a difficult refcount issue. buck <workitharder@gmail.com> - 2011-12-17 20:17 -0800
  Re: Debugging a difficult refcount issue. Paul Rubin <no.email@nospam.invalid> - 2011-12-17 23:55 -0800
    Re: Debugging a difficult refcount issue. buck <workitharder@gmail.com> - 2011-12-18 08:06 -0800
  Re: Debugging a difficult refcount issue. Jack Diederich <jackdied@gmail.com> - 2011-12-18 12:52 -0500
    Re: Debugging a difficult refcount issue. buck <workitharder@gmail.com> - 2011-12-18 18:01 -0800
      Re: Debugging a difficult refcount issue. buck <workitharder@gmail.com> - 2011-12-19 00:09 -0800
      Re: Debugging a difficult refcount issue. buck <workitharder@gmail.com> - 2011-12-19 00:09 -0800
    Re: Debugging a difficult refcount issue. buck <workitharder@gmail.com> - 2011-12-18 18:01 -0800

csiph-web