Python 3.7.1 is hung

0

I am trying to execute a pytest script as follows:

python3.7.1 -m pytest test.py

All the tests from test.py are executed and passed but Python 3.7.1 is hanging indefinitely.

I have entered into gdb and taken the following backtrace:

(gdb) bt
#0  sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
#1  0x00007f9010ae5d05 in PyThread_acquire_lock_timed (lock=lock@entry=0x7f8ff4000af0, microseconds=microseconds@entry=-1000000, intr_flag=intr_flag@entry=1) at Python/thread_pthread.h:340
#2  0x00007f9010b333a4 in acquire_timed (timeout=-1000000000, lock=0x7f8ff4000af0) at ./Modules/_threadmodule.c:61
#3  lock_PyThread_acquire_lock (self=0x7f9007137f30, args=<optimized out>, kwds=<optimized out>) at ./Modules/_threadmodule.c:144
#4  0x00007f90109d9c13 in _PyMethodDef_RawFastCallKeywords (method=<optimized out>, self=self@entry=0x7f9007137f30, args=args@entry=0x7f90005741e0, nargs=nargs@entry=2, kwnames=kwnames@entry=0x0)
at Objects/call.c:690
#5  0x00007f90109e28fe in _PyMethodDescr_FastCallKeywords (descrobj=0x7f900fa103a8, args=args@entry=0x7f90005741d8, nargs=nargs@entry=3, kwnames=kwnames@entry=0x0) at Objects/descrobject.c:288
#6  0x00007f90109b6048 in call_function (kwnames=0x0, oparg=3, pp_stack=<synthetic pointer>) at Python/ceval.c:4579
#7  _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3110
#8  0x00007f9010aa5e09 in _PyEval_EvalCodeWithName (_co=0x7f900ee08810, globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, argcount=1, kwnames=0x0, kwargs=kwargs@entry=0x7f90070a9388,
kwcount=0, kwstep=kwstep@entry=1, defs=defs@entry=0x7f900ee0aa20, defcount=defcount@entry=2, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=0x7f900ee07810, qualname=0x7f900ee01c60)
at Python/ceval.c:3930
#9  0x00007f90109d96c9 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Objects/call.c:433
#10 0x00007f90109b6816 in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>) at Python/ceval.c:4602
#11 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3110
#12 0x00007f9010aa5e09 in _PyEval_EvalCodeWithName (_co=0x7f900ee08780, globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>, argcount=1, kwnames=0x0, kwargs=kwargs@entry=0x7f8fcd4301d8,
kwcount=0, kwstep=kwstep@entry=1, defs=defs@entry=0x7f900ee0b840, defcount=defcount@entry=1, kwdefs=kwdefs@entry=0x0, closure=closure@entry=0x0, name=0x7f900fa28d50, qualname=0x7f900ee0a4f0)
at Python/ceval.c:3930
#13 0x00007f90109d96c9 in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Objects/call.c:433
#14 0x00007f90109b6816 in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>) at Python/ceval.c:4602
#15 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3110
#16 0x00007f90109ad2cb in function_code_fastcall (co=<optimized out>, args=<optimized out>, nargs=1, globals=<optimized out>) at Objects/call.c:283
#17 0x00007f90109d97bf in _PyFunction_FastCallKeywords (func=<optimized out>, stack=<optimized out>, nargs=<optimized out>, kwnames=<optimized out>) at Objects/call.c:415
#18 0x00007f90109b6816 in call_function (kwnames=0x0, oparg=<optimized out>, pp_stack=<synthetic pointer>) at Python/ceval.c:4602
#19 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3110
#20 0x00007f90109ad2cb in function_code_fastcall (co=co@entry=0x7f9007c98e40, args=<optimized out>, args@entry=0x7ffead4a50e0, nargs=nargs@entry=1, globals=globals@entry=0x7f9007c7eea0)
at Objects/call.c:283
#21 0x00007f90109d95ff in _PyFunction_FastCallDict (func=0x7f9007e6f2f0, args=0x7ffead4a50e0, nargs=1, kwargs=0x0) at Objects/call.c:322
#22 0x00007f9010a3307a in call_unbound_noarg (self=0x7f9003968ba8, func=0x7f9007e6f2f0, unbound=<optimized out>) at Objects/typeobject.c:1493
#23 call_unbound_noarg (self=0x7f9003968ba8, func=0x7f9007e6f2f0, unbound=1) at Objects/typeobject.c:6645
#24 slot_tp_finalize (self=0x7f9003968ba8) at Objects/typeobject.c:6658
#25 0x00007f9010afc2c9 in finalize_garbage (collectable=0x7ffead4a5170) at Modules/gcmodule.c:703
#26 collect (generation=generation@entry=2, n_collected=n_collected@entry=0x0, n_uncollectable=n_uncollectable@entry=0x0, nofail=nofail@entry=1) at Modules/gcmodule.c:905
#27 0x00007f9010afcf1d in _PyGC_CollectNoFail () at Modules/gcmodule.c:1605
#28 0x00007f9010ac3a82 in PyImport_Cleanup () at Python/import.c:526
#29 0x00007f9010ad0098 in Py_FinalizeEx () at Python/pylifecycle.c:1192
#30 Py_FinalizeEx () at Python/pylifecycle.c:1117
#31 0x00007f9010ad0878 in Py_Exit (sts=sts@entry=0) at Python/pylifecycle.c:2250
#32 0x00007f9010ad9d91 in handle_system_exit () at Python/pythonrun.c:636
#33 0x00007f9010ada116 in handle_system_exit () at Python/pythonrun.c:588
#34 PyErr_PrintEx (set_sys_last_vars=set_sys_last_vars@entry=1) at Python/pythonrun.c:646
#35 0x00007f9010ada35a in PyErr_Print () at Python/pythonrun.c:542
#36 0x00007f9010af602d in pymain_run_module (modname=<optimized out>, set_argv0=set_argv0@entry=1) at Modules/main.c:322
#37 0x00007f9010af6374 in pymain_run_python (pymain=pymain@entry=0x7ffead4a5550) at Modules/main.c:2623
#38 0x00007f9010afb128 in pymain_main (pymain=0x7ffead4a5550) at Modules/main.c:2787
#39 _Py_UnixMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:2822
#40 0x00007f900fa84715 in __libc_start_main (main=0x400720 <main>, argc=4, ubp_av=0x7ffead4a56a8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffead4a5698)
at libc-start.c:225
#41 0x0000000000400751 in _start ()
(gdb) info threads
  Id   Target Id         Frame
  2    Thread 0x7f9002ef0700 (LWP 1124) "python3.7.1" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
* 1    Thread 0x7f90112c2700 (LWP 1048) "python3.7.1" sem_wait () at ../nptl/sysdeps/unix/sysv/linux/x86_64/sem_wait.S:85
(gdb)

I couldn't understand why my program is hanging. Can you please help me in understanding the above stack trace?

Amresh Sajjanshetty

Posted 2019-04-24T18:23:37.583

Reputation: 1

No answers