Red Hat Bugzilla – Bug 842403
modules command in python help is hanging
Last modified: 2013-07-31 15:33:12 EDT
Created attachment 599840 [details]
Description of problem:
If I try to see all installed modules in python help, the interpreter hangs.
Version-Release number of selected component (if applicable): pygtk2-2.24.0-4.fc17.x86_64
Steps to Reproduce:
1. open python
2. type help()
3. type modules
Supposed to show us all installed modules.
While talking about the issue in #fedora-desktop, halfline suggested to try
$ LD_PRELOAD=/usr/lib64/libgtk-x11-2.0.so python
and after that if I try to view the installed modules I get teh following
$ LD_PRELOAD=/usr/lib64/libgtk-x11-2.0.so python
Python 2.7.3 (default, Apr 30 2012, 21:18:11)
[GCC 4.7.0 20120416 (Red Hat 4.7.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Welcome to Python 2.7! This is the online help utility.
If this is your first time using Python, you should definitely check out
the tutorial on the Internet at http://docs.python.org/tutorial/.
Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type "quit".
To get a list of available modules, keywords, or topics, type "modules",
"keywords", or "topics". Each module also comes with a one-line summary
of what it does; to list the modules whose summaries contain a given word
such as "spam", type "modules spam".
Please wait a moment while I gather a list of all available modules...
dm.c: 1693: not running as root returning empty list
** (process:10626): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'
** (process:10626): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'
** (process:10626): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Gtk-Message: Failed to load module "pk-gtk-module"
/usr/lib64/python2.7/pkgutil.py:110: UserWarning: libevent version mismatch: system version is '2.0.18-stable' but this gevent is compiled against '2.0.14-stable'
** Message: pygobject_register_sinkfunc is deprecated (GstObject)
Use bootstrap.py and buildout to create executable
I am also attaching bt output from the first try (got it from gdb)
Created attachment 599842 [details]
IRC log of the discussion
Attaching the IRC log discussion on the topic.
Created attachment 599847 [details]
Attaching LD_DEBUG=all python output
Created attachment 599852 [details]
Log from a fresh Fedora installation
This is output from a fresh F17 installation
Changing the component to Python to track the actual development in python. Will file indivitual bugs for each packages which are causing the issue.
To summarize: "help> modules" tries to import every Python module on the system, so that it can print metadata about them. These imports leads to a chain of dynamic loading in which the process tries to import parts of both gtk2 and gtk3 stacks, and it hangs initializing one of gtk stacks (presumably the second stack).
Doing so isn't supported, but clearly Python shouldn't hang like this.
* somehow detect when both gtk2 and gtk3 components are attempted to be loaded, and trigger a runtime error that can propagate back up as an exception (since there may be other Python code out there that tries to import things that would cause both stacks to be loaded). Is there a way of doing this within the gtk stack? (or maybe easier to do in pygobject/pygtk? though that wouldn't cover the case where a 3rd-party module has indirectly caused a gtk stack to be dynamically linked into the process).
* reimplement pydoc so that each module is loaded in a subprocess, sandboxing the python process against issues like this. We've had no end of issues over the years with buggy modules breaking the help functionality. (IIRC the keyword search works in a similar way, so this would help with that). Would be a non-trivial path to Python's Lib/pydoc.py
With more debugging I gathered the following information :
import clutter -- hangs, package -- pyclutter-1.3.2-10.fc17.x86_64
import gnomedvb -- hangs, package -- gnome-dvb-daemon-0.2.8-1.fc17.x86_64
import rst2pdf.tests -- python interpreter exists, package -- rst2pdf-0.92-1.fc17.noarch.rpm
It also prints "Use bootstrap.py and buildout to create executable" before exiting.
import liveusb -- python interpreter exists, package --
Line number 52 in liveusb/__init__.py , doing a sys.exit(1) if it is non-root user
I also had to patch pkgutil.py after removing all the above mention packages to make modules command work.
One can use the following code to find out which module is causing trouble:
for x,y,z in pkgutil.walk_packages():
Created attachment 600062 [details]
patch for pkgutil
https://bugzilla.redhat.com/show_bug.cgi?id=843416 might give some more info, I could generate some backtrace with abrt
(In reply to comment #6)
> import liveusb -- python interpreter exists, package --
> Line number 52 in liveusb/__init__.py , doing a sys.exit(1) if it is
> non-root user
I just fixed this issue upstream (Bug #842878)
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
This message is a reminder that Fedora 17 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 17. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '17'.
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 17's end of life.
Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 17 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged change the
'version' to a later Fedora version prior to Fedora 17's end of life.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 17 changed to end-of-life (EOL) status on 2013-07-30. Fedora 17 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version.
Thank you for reporting this bug and we are sorry it could not be fixed.