This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients Aaron.Meurer, BreamoreBoy, Tim.Graham, amaury.forgeotdarc, anacrolix, asvetlov, brechtm, eric.snow, ezio.melotti, giampaolo.rodola, jcea, josh.r, kachayev, kmike, meador.inge, pitrou, poke, python-dev, rhettinger, scoder, serhiy.storchaka
Date 2015-07-10.17:59:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1436551192.55.0.730731079802.issue14373@psf.upfronthosting.co.za>
In-reply-to
Content
I'm witnessing a crash in the C implementation during garbage collection. Interestingly, it only shows in the Py3.6 branch, not in Py3.5 (both latest). Here's the gdb session:

Program received signal SIGSEGV, Segmentation fault.
lru_cache_tp_traverse (self=0x7ffff2a80ae8, visit=0x43c528 <visit_decref>, arg=0x0) at ./Modules/_functoolsmodule.c:1040
1040            lru_list_elem *next = link->next;
(gdb) list
1035    static int
1036    lru_cache_tp_traverse(lru_cache_object *self, visitproc visit, void *arg)
1037    {
1038        lru_list_elem *link = self->root.next;
1039        while (link != &self->root) {
1040            lru_list_elem *next = link->next;
1041            Py_VISIT(link);
1042            link = next;
1043        }
1044        Py_VISIT(self->maxsize_O);
(gdb) print link
$1 = (lru_list_elem *) 0x0
(gdb) print self
$2 = (lru_cache_object *) 0x7ffff2a80ae8
(gdb) print self->root.next
$3 = (struct lru_list_elem *) 0x0
(gdb) print self->root
$4 = {ob_base = {_ob_next = 0x7ffff2a26458, _ob_prev = 0x90e860 <refchain>, ob_refcnt = 1, ob_type = 0x92c500 <lru_cache_type>}, prev = 0x0, next = 0x0, key = 0x0, result = 0x0}

IIUC correctly, there is only one entry and the code doesn't expect that. An additional "is empty?" NULL check may or may not be the right fix. It might also be the linking itself that's incorrect here. The code seems to expect a cyclic data structure which is apparently not maintained that way.
History
Date User Action Args
2015-07-10 17:59:52scodersetrecipients: + scoder, rhettinger, jcea, amaury.forgeotdarc, pitrou, giampaolo.rodola, ezio.melotti, asvetlov, poke, meador.inge, anacrolix, Aaron.Meurer, BreamoreBoy, python-dev, eric.snow, serhiy.storchaka, brechtm, kmike, kachayev, josh.r, Tim.Graham
2015-07-10 17:59:52scodersetmessageid: <1436551192.55.0.730731079802.issue14373@psf.upfronthosting.co.za>
2015-07-10 17:59:52scoderlinkissue14373 messages
2015-07-10 17:59:51scodercreate