Created
March 17, 2024 14:16
-
-
Save methane/1596ddbb5c52263cabf1682d3793b64c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Run uwsgi | |
uwsgi --wsgi-file=mt_sample.py --threads 8 --workers 4 --max-requests 40 --http-socket=:8000 --master --min-worker-lifetime=7 -L | |
Run hey[1] | |
hey -c 32 -z 10m 'http://127.0.0.1:8000/' | |
[1] hey: https://github.com/rakyll/hey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is backtrace of worker doesn't stop. | |
(gdb) bt | |
#0 0x00007edda74940f6 in __futex_abstimed_wait_common64 (private=<optimized out>, cancel=true, abstime=0x0, op=393, expected=0, | |
futex_word=0x7edda0000b70) at ./nptl/futex-internal.c:57 | |
#1 __futex_abstimed_wait_common (cancel=true, private=<optimized out>, abstime=0x0, clockid=0, expected=0, futex_word=0x7edda0000b70) | |
at ./nptl/futex-internal.c:87 | |
#2 __GI___futex_abstimed_wait_cancelable64 (futex_word=futex_word@entry=0x7edda0000b70, expected=expected@entry=0, clockid=clockid@entry=0, | |
abstime=abstime@entry=0x0, private=<optimized out>) at ./nptl/futex-internal.c:139 | |
#3 0x00007edda749fc0f in do_futex_wait (sem=sem@entry=0x7edda0000b70, abstime=0x0, clockid=0) at ./nptl/sem_waitcommon.c:111 | |
#4 0x00007edda749fca0 in __new_sem_wait_slow64 (sem=0x7edda0000b70, abstime=0x0, clockid=0) at ./nptl/sem_waitcommon.c:183 | |
#5 0x00007edda749fd11 in __new_sem_wait (sem=<optimized out>) at ./nptl/sem_wait.c:42 | |
#6 0x00007edda7d1b1a9 in PyThread_acquire_lock_timed (lock=0x7edda0000b70, microseconds=393, intr_flag=0) at Python/thread_pthread.h:497 | |
#7 0x00007edda7dbefa2 in acquire_timed (lock=0x7edda0000b70, timeout=-1000000000) at ./Modules/_threadmodule.c:98 | |
#8 0x00007edda7dbf21d in lock_PyThread_acquire_lock (self=0x7edda7392480, args=<optimized out>, kwds=<optimized out>) | |
at ./Modules/_threadmodule.c:179 | |
#9 0x00007edda7b58e1b in method_vectorcall_VARARGS_KEYWORDS (func=0x7edda77330b0, args=0x7edda8fa3098, nargsf=<optimized out>, | |
kwnames=<optimized out>) at Objects/descrobject.c:364 | |
#10 0x00007edda7bea390 in _PyObject_VectorcallTstate (tstate=0x7edda8f48c58 <_PyRuntime+166328>, callable=0x246, args=0x7edda8fa3098, | |
nargsf=<optimized out>, kwnames=<optimized out>) at ./Include/internal/pycore_call.h:92 | |
#11 PyObject_Vectorcall (callable=0x246, args=0x7edda8fa3098, nargsf=<optimized out>, kwnames=<optimized out>) at Objects/call.c:299 | |
#12 _PyEval_EvalFrameDefault (tstate=0x7edda8f48c58 <_PyRuntime+166328>, frame=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:4769 | |
#13 0x00007edda7b52f8a in _PyEval_EvalFrame (tstate=<optimized out>, frame=0x7edda8fa3020, throwflag=0) at ./Include/internal/pycore_ceval.h:73 | |
#14 _PyEval_Vector (tstate=0x7edda8f48c58 <_PyRuntime+166328>, func=0x7edda739e5c0, locals=<optimized out>, args=<optimized out>, | |
argcount=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:6434 | |
#15 0x00007edda7b52f8a in _PyFunction_Vectorcall (func=0x7edda739e5c0, stack=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) | |
from /home/methane/.rye/py/[email protected]/install/lib/libpython3.11.so.1.0 | |
#16 0x00007edda7a29466 in _PyObject_VectorcallTstate (tstate=0x7edda8f48c58 <_PyRuntime+166328>, callable=0x7edda739e5c0, args=0x7fffc56ce028, | |
nargsf=9223372036854775808, kwnames=0x0) at ./Include/internal/pycore_call.h:92 | |
#17 PyObject_VectorcallMethod (name=<optimized out>, args=0x7fffc56ce028, nargsf=9223372036854775808, kwnames=0x0) at Objects/call.c:855 | |
#18 0x00007edda7d10762 in PyObject_CallMethodNoArgs (self=0x7edda7328db0, name=0x7edda0000b70) at ./Include/cpython/abstract.h:107 | |
#19 wait_for_thread_shutdown (tstate=0x7edda8f48c58 <_PyRuntime+166328>) at Python/pylifecycle.c:2902 | |
#20 0x00007edda7d102b1 in Py_FinalizeEx () at Python/pylifecycle.c:1764 | |
#21 0x000056297da3a0f2 in uwsgi_plugins_atexit () at core/uwsgi.c:1820 | |
#22 0x00007edda74451a6 in __run_exit_handlers (status=status@entry=0, listp=0x7edda75fe860 <__exit_funcs>, | |
run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at ./stdlib/exit.c:111 | |
#23 0x00007edda74452e0 in __GI_exit (status=status@entry=0) at ./stdlib/exit.c:141 | |
#24 0x000056297d9e72f3 in uwsgi_exit (status=-1610609808, status@entry=0) at core/utils.c:4453 | |
#25 0x000056297da391bd in simple_goodbye_cruel_world () at core/uwsgi.c:1298 | |
#26 goodbye_cruel_world () at core/uwsgi.c:1305 | |
#27 0x000056297d9e95ff in uwsgi_close_request (wsgi_req=0x7edda760f078) at core/utils.c:1205 | |
#28 0x000056297da37a09 in simple_loop_run (arg1=arg1@entry=0x0) at core/loop.c:151 | |
#29 0x000056297da378ae in uwsgi_loop_cores_run (func=<optimized out>) at core/loop.c:74 | |
#30 simple_loop () at core/loop.c:62 | |
#31 0x000056297da3f34f in uwsgi_ignition () at core/uwsgi.c:3615 | |
#32 0x000056297da3f09f in uwsgi_worker_run () at core/uwsgi.c:3543 | |
#33 0x000056297da3cb84 in uwsgi_run () at core/uwsgi.c:3453 | |
#34 0x000056297da3a2bb in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at core/uwsgi.c:2051 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import atexit, sys, time, threading | |
sleep = True | |
def sleeper(): | |
while sleep: | |
time.sleep(1) | |
#th = threading.Thread(target=sleeper, daemon=True) | |
th = threading.Thread(target=sleeper) | |
th.start() | |
@atexit.register | |
def stop_sleep(): | |
global sleep | |
print("stop_sleap is called", file=sys.stderr) | |
sleep = False | |
th.join() | |
def application(env, start_response): | |
time.sleep(1) | |
start_response('200 OK', [('Content-Type','text/html')]) | |
return [b"Hello World"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment