This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dylan Cali
Recipients Dylan Cali
Date 2018-11-01.10:40:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1541068819.38.0.788709270274.issue35132@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2018-11-01 10:40:19Dylan Calisetrecipients: + Dylan Cali
2018-11-01 10:40:19Dylan Calisetmessageid: <1541068819.38.0.788709270274.issue35132@psf.upfronthosting.co.za>
2018-11-01 10:40:19Dylan Calilinkissue35132 messages
2018-11-01 10:40:18Dylan Calicreate