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 yselivanov
Recipients ned.deily, serhiy.storchaka, vstinner, yselivanov
Date 2016-04-18.18:35:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461004554.65.0.108278995171.issue26797@psf.upfronthosting.co.za>
In-reply-to
Content
I'm working on an implementation of asyncio event loop on top of libuv [1].  One of my tests crashes on Mac OS X with a segfault [2].  The problem is that it's not consistent -- looks like it depends on size of uvloop so binary, or/and amount of objects allocated in program.

I can't reproduce the problem on a debug build, or write a test for it, it is really a weird edge-case.  But I'm certain that we have a bug in our memory allocator.

Here's a screenshot of crash log [3], and here's an lldb disassembly of crash location [4].

Now, what's going on in [2] is:
1. uvloop sets a sigint signal handler the moment it starts the loop
2. uvloop start to execute a coroutine, which blocks on a long "time.sleep(..)" call
3. sigint handler receives a SIGINT and calls PyErr_SetInterrupt
4. CPython interrupts the code, KeyboardInterrupt is instantiated and raised
5. CPython starts to render the traceback to print it to stderr, and this is where it tries to allocate some object, and this is where we hit a bad-access in _PyObject_Alloc.

I'd really appreciate any ideas on what's going on here and how we can fix this.


[1] https://github.com/magicstack/uvloop
[2] https://github.com/MagicStack/uvloop/blob/v0.4.6/tests/test_signals.py#L14
[3] http://imgur.com/6GcE92X
[4] https://gist.github.com/1st1/b46f3702aeb1b57fe4ad32b19ed63c3f
History
Date User Action Args
2016-04-18 18:35:54yselivanovsetrecipients: + yselivanov, vstinner, ned.deily, serhiy.storchaka
2016-04-18 18:35:54yselivanovsetmessageid: <1461004554.65.0.108278995171.issue26797@psf.upfronthosting.co.za>
2016-04-18 18:35:54yselivanovlinkissue26797 messages
2016-04-18 18:35:54yselivanovcreate