Python debugger segfaults with tvm


Hi. Does anyone use python debugger with tvm? I got a segfault every time I’m trying to enter the trace mode. For example, I see the segfault in the program below. If one comments import tvm out and restarts ipython, segfault goes away.

import pdb
import tvm

def test():
  return x

Thread 1 "python3.6" received signal SIGSEGV, Segmentation fault.
0x0000000000579b80 in PyModule_GetState ()
(gdb) bt
#0  0x0000000000579b80 in PyModule_GetState ()
#1  0x00007f43ba9fc67e in ?? () from /usr/lib/python3.6/lib-dynload/
#2  0x00007f43c21ec3e1 in rl_initialize () from /usr/lib/x86_64-linux-gnu/
#3  0x00007f43ba9fc485 in PyInit_readline () from /usr/lib/python3.6/lib-dynload/
#4  0x0000000000604ea7 in _PyImport_LoadDynamicModuleWithSpec ()
#5  0x0000000000605f66 in ?? ()
#6  0x00000000005871a0 in PyCFunction_Call ()
#7  0x000000000054840c in _PyEval_EvalFrameDefault ()
#8  0x00000000005414d0 in ?? ()
#9  0x0000000000539912 in ?? ()



Two workarounds which work for me:

  1. Starting Python with -m pdb and throwing an exception instead of set_trace() call. Or -m pdb -c "bp ..." to set a breakpoint from the command line.

  2. Not the debugger, but from IPython import embed; embed() works. Surprising since it should be using readline too.


Unfortunately, __import__('IPython').core.debugger.Pdb(color_scheme='Linux').set_trace() fails when loading readline as well, even though the documentation says

Modified from the standard pdb.Pdb class to avoid including readline, so that the command line completion of other programs which include this isn’t damaged.

I’ve tried other core.debugger and terminal.debugger classes, all of them have the same problem.


To get full debugging, pudb ( works for me.