New submission from Yury Selivanov:

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

----------
messages: 263678
nosy: haypo, ned.deily, serhiy.storchaka, yselivanov
priority: normal
severity: normal
stage: test needed
status: open
title: Segafault in _PyObject_Alloc
type: crash
versions: Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue26797>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to