uwsgi+gevent segfault

243 views
Skip to first unread message

Weikang Jin

unread,
Jul 3, 2017, 8:26:51 PM7/3/17
to gevent: coroutine-based Python network library
hi,
     env: 
             centos 7
             uwsgi 1.9.20
             gevent 1.2.2

     core:
           Core was generated by `/root/uwsgi-1.9.20/uwsgi --ini /srv/kernel/uwsgi.config --gevent 800 --gevent-m'.
Program terminated with signal 11, Segmentation fault.
#0  0x00007f777d5817c0 in do_futex_wait (sem=<optimized out>, abstime=0x0)
    at ../nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c:231

    bt:

    #0  0x00007f777d5817c0 in do_futex_wait (sem=<optimized out>, abstime=0x0)
    at ../nptl/sysdeps/unix/sysv/linux/sem_waitcommon.c:231
#1  0x00007f776c001100 in ?? ()
#2  0x000000000058a408 in PyThread_acquire_lock (lock=0x3554b10, waitflag=<optimized out>)
    at Python/thread_pthread.h:324
#3  0x000000000058e90e in lock_PyThread_acquire_lock (self=0x3554b10, args=<optimized out>)
    at ./Modules/threadmodule.c:52
#4  0x00000000005475f6 in call_function (oparg=<optimized out>, pp_stack=0x7f7770f305a0)
    at Python/ceval.c:4021
#5  PyEval_EvalFrameEx (f=f@entry=
    Frame 0x7f776c001890, for file /usr/local/lib/python2.7/site-packages/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/_threading.py, line 152, in wait (self=<Condition(release=<built-in method release of thread.lock object at remote 0x3554a50>, _Condition__lock=<thread.lock at remote 0x3554a50>, acquire=<built-in method acquire of thread.lock object at remote 0x3554a50>, _Condition__waiters=[<thread.lock at remote 0x3554b10>]) at remote 0x4a6d310>, timeout=None, waiter=<thread.lock at remote 0x3554b10>, saved_state=None), throwflag=throwflag@entry=0)
    at Python/ceval.c:2666
#6  0x0000000000548188 in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>,
    locals=locals@entry=0x0, args=<optimized out>, argcount=argcount@entry=1,
    kws=0x7f776c000cf0, kwcount=0, defs=0x4a82568, defcount=1, closure=0x0)
    at Python/ceval.c:3253
#7  0x0000000000546fc2 in fast_function (nk=<optimized out>, na=1, n=<optimized out>,
    pp_stack=0x7f7770f30790, func=<function at remote 0x4a85668>) at Python/ceval.c:4117
#8  call_function (oparg=<optimized out>, pp_stack=0x7f7770f30790) at Python/ceval.c:4042
#9  PyEval_EvalFrameEx (
    f=f@entry=Frame 0x7f776c000b40, for file /usr/local/lib/python2.7/site-packages/gevent-1.2.2-py2.7-linux-x86_64.egg/gevent/_threading.py, line 436, in get (self=<Queue(unfinished_tasks=0, queue=<collections.deque at remote 0x49bbd00>, maxsize=0, all_tasks_done=<Condition(release=<built-in method release of thread.lock object at remote 0x3554a50>, _Condition__lock=<thread.lock at remote 0x3554a50>, acquire=<built-in method acquire of thread.lock object at remote 0x3554a50>, _Condition__waiters=[]) at remote 0x4a6d650>, mutex=<thread.lock at remote 0x3554a50>, not_full=<Condition(release=<built-in method release of thread.lock object at remote 0x3554a50>, _Condition__lock=<thread.lock at remote 0x3554a50>, acquire=<built-in method acquire of thread.lock object at remote 0x3554a50>, _Condition__waiters=[]) at remote 0x4a6d950>, not_empty=<Condition(release=<built-in method release of thread.lock object at remote 0x3554a50>, _Condition__lock=<thread.lock at remote 0x3554a50>, acquire=<built-in method acquire of thread.lock...(truncated),
---Type <return> to continue, or q <return> to quit---
    throwflag=throwflag@entry=0) at Python/ceval.c:2666
#10 0x0000000000548188 in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>,
    locals=locals@entry=0x0, args=<optimized out>, argcount=argcount@entry=1,
    kws=0x7f776c000ae8, kwcount=0, defs=0x4815cc8, defcount=2, closure=0x0)
    at Python/ceval.c:3253
#11 0x0000000000546fc2 in fast_function (nk=<optimized out>, na=1, n=<optimized out>,
    pp_stack=0x7f7770f30980, func=<function at remote 0x4a861b8>) at Python/ceval.c:4117
#12 call_function (oparg=<optimized out>, pp_stack=0x7f7770f30980) at Python/ceval.c:4042
Python Exception <type 'exceptions.UnicodeDecodeError'> 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte:
#13 PyEval_EvalFrameEx (f=f@entry=, throwflag=throwflag@entry=0) at Python/ceval.c:2666
#14 0x0000000000548188 in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>,
    locals=locals@entry=0x0, args=args@entry=0x49d39e8, argcount=1, kws=kws@entry=0x0,
    kwcount=kwcount@entry=0, defs=defs@entry=0x0, defcount=defcount@entry=0, closure=0x0)
    at Python/ceval.c:3253
Python Exception <type 'exceptions.UnicodeDecodeError'> 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte:
#15 0x00000000004d1cb0 in function_call (func=<function at remote 0x4a81050>, arg=, kw=0x0)
    at Objects/funcobject.c:526
#16 0x00000000004b0daa in PyObject_Call (func=func@entry=<function at remote 0x4a81050>,
Python Exception <type 'exceptions.UnicodeDecodeError'> 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte:
    arg=arg@entry=, kw=kw@entry=0x0) at Objects/abstract.c:2529
Python Exception <type 'exceptions.UnicodeDecodeError'> 'utf8' codec can't decode byte 0xc7 in position 0: invalid continuation byte:
#17 0x00000000004b550d in instancemethod_call (func=<function at remote 0x4a81050>, arg=,
    kw=0x0) at Objects/classobject.c:2602
#18 0x00000000004b0daa in PyObject_Call (func=func@entry=<instancemethod at remote 0x4a4e9b0>,
    arg=arg@entry=(), kw=<optimized out>) at Objects/abstract.c:2529
#19 0x00000000005419d7 in PyEval_CallObjectWithKeywords (
    func=<instancemethod at remote 0x4a4e9b0>, arg=(), kw=<optimized out>)
    at Python/ceval.c:3890
#20 0x000000000058ec92 in t_bootstrap (boot_raw=0x4af2840) at ./Modules/threadmodule.c:614
#21 0x00007f777d57bdf5 in start_thread (arg=0x7f7770f31700) at pthread_create.c:328
#22 0x00007f777be9a1ad in fgetxattr () at ../sysdeps/unix/syscall-template.S:83
#23 0x0000000000000000 in ?? ()

    py-list:

(gdb) py-list
 147            waiter.acquire()
 148            self.__waiters.append(waiter)
 149            saved_state = self._release_save()
 150            try:    # restore state no matter what (e.g., KeyboardInterrupt)
 151                if timeout is None:
>152                    waiter.acquire()
 153                else:
 154                    # Balancing act:  We can't afford a pure busy loop, so we
 155                    # have to sleep; but if we sleep the whole timeout time,
 156                    # we'll be unresponsive.  The scheme here sleeps very
 157                    # little at first, longer as time goes on, but never longer


thx
    

    

Grady Player

unread,
Jul 3, 2017, 9:51:03 PM7/3/17
to gev...@googlegroups.com
My reading of that stack trace looks like the problem is in clib wait, which shouldn't be called from gevent... you should monkey patch or call gevent.wait

Grady


Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "gevent: coroutine-based Python network library" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gevent+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages