[New-bugs-announce] [issue35132] python-gdb error: Python Exception <class 'RuntimeError'> Type does not have a target

Dylan Cali report at bugs.python.org
Thu Nov 1 06:40:19 EDT 2018


New submission from Dylan Cali <calid1984 at gmail.com>:

Python version: 3.6.6-debug
System: Kernel: 4.15.0-38-generic x86_64
        Distro: Linux Mint 18.2 Sonya
CPU:    Quad core Intel Xeon E3-1505M
Memory: 32018.6MB


Expected:

py-list and py-bt to print the current python frame and traceback when attaching to a hung python process with gdb, a debug build of python, and cpython/Tools/gdb/libpython.py loaded.


Actual:

py-list and py-bt fail with:

    Python Exception <class 'RuntimeError'> Type does not have a target.:
    Error occurred in Python command: Type does not have a target.

Invoking 'set python print-stack full' in gdb produces the more useful:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "~/git/cpython/Tools/gdb/libpython.py", line 916, in filename
      File "~/git/cpython/Tools/gdb/libpython.py", line 1158, in proxyval
    RuntimeError: Type does not have a target.

so it is failing at:

    fields = gdb.lookup_type('PyUnicodeObject').target().fields()

in libpython.py [1].


Reproduce:

I haven't been able to create a simple standalone program that triggers the failure.  I am working on a PR for Keras to try and fix the multiprocessing support in some of their utility classes.  Currently the tests are sporadically hanging and my intention was to use python's gdb integration to identify exactly where and why the hangs are occuring... but I can't get that information at the moment because of the error above when invoking py-list and py-bt.

So, unfortunately, the shortest path to reproduce is to checkout the PR branch, run the offending tests, connect with gdb, and invoke py-list/py-bt:

    * install a debug version of 3.6.6 if one isn't already available
    * git clone https://github.com/calid/keras.git -b fix-multiprocessing-hang
    * cd keras
    * pip install -e .[tests]
    * pip install tensorflow
    * py.test tests/keras/utils/data_utils_test.py
    * wait for hang
    * gdb -p <parent_pid_of_harness>
    * invoke py-list or py-bt


I am happy to poke around in libpython.py and try to fix/submit a PR myself, but I'm not at all familiar with the python internals so I would need some guidance.  And obviously let me know if this isn't actually a bug but rather environment related/user error.

Thank you!


[1] https://github.com/python/cpython/blob/v3.6.6/Tools/gdb/libpython.py#L1158

----------
components: Demos and Tools
messages: 329052
nosy: Dylan Cali
priority: normal
severity: normal
status: open
title: python-gdb error: Python Exception <class 'RuntimeError'> Type does not have a target
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35132>
_______________________________________


More information about the New-bugs-announce mailing list