Author thehesiod
Recipients thehesiod, yselivanov
Date 2017-07-27.20:16:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1501186590.27.0.993176632925.issue31061@psf.upfronthosting.co.za>
In-reply-to
Content
I have a project in a prod environment which heavily uses asyncio and a threadpool.  It uses the threadpool to run CPU heavy tasks (in this case populating a defaultdict) to avoid blocking the main thread (no async code in thread).  For some time now my service has been randomly crashing at the same place in the thread which does the dict updating.  I've finally got both the python and native stack traces, and based on the information presented it looked very similar to the issue found by the devs at home-assistant (https://github.com/home-assistant/home-assistant/issues/7752#issuecomment-305100009, which points to https://github.com/home-assistant/home-assistant/pull/7848).  So I tried their fix of disabling the "_asyncio" module, and lo and behold python no longer segfaults.

Per the stacktrace it's crashing in PyObject_GC_Del, and the only place this is used in the asyncio module seems to be here: https://github.com/python/cpython/blob/master/Modules/_asynciomodule.c#L996

does anyone have any idea why it's crashing on this line?  Are there thread protections missing in this file?

I'm trying to reproduce this in a testcase but it's proving very difficult as I'm guessing it's timing related.
History
Date User Action Args
2017-07-27 20:16:30thehesiodsetrecipients: + thehesiod, yselivanov
2017-07-27 20:16:30thehesiodsetmessageid: <1501186590.27.0.993176632925.issue31061@psf.upfronthosting.co.za>
2017-07-27 20:16:30thehesiodlinkissue31061 messages
2017-07-27 20:16:30thehesiodcreate