enabling the contextinfo plugin causes exaile to crash

Bug #1086669 reported by Forest
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Fix Released
Undecided
Dustin Spicuzza

Bug Description

On a fresh new install of xubuntu quantal amd64, trying to enable exaile 3.3.1's contextinfo plugin crashes the process. The following is printed to the console when this happens:

** (exaile.py:6612): CRITICAL **: mist_style_draw_focus: assertion `width >= -1' failed
1 0x7fc4d8f886fd /usr/lib/libjavascriptcoregtk-1.0.so.0(_ZN3WTF10StringImplD1Ev+0x12d) [0x7fc4d8f886fd]
2 0x7fc4d8eb1258 /usr/lib/libjavascriptcoregtk-1.0.so.0(_ZN3JSC12hasErrorInfoEPNS_9ExecStateEPNS_8JSObjectE+0x198) [0x7fc4d8eb1258]
3 0x7fc4d8dd13bd /usr/lib/libjavascriptcoregtk-1.0.so.0(_ZN3JSC11Interpreter14throwExceptionERPNS_9ExecStateERNS_7JSValueEj+0x6d) [0x7fc4d8dd13bd]
4 0x7fc4d8def633 /usr/lib/libjavascriptcoregtk-1.0.so.0(_ZN3JSC12genericThrowEPNS_12JSGlobalDataEPNS_9ExecStateENS_7JSValueEj+0x33) [0x7fc4d8def633]
5 0x7fc4d8e1df6e /usr/lib/libjavascriptcoregtk-1.0.so.0(_ZN3JSC5LLInt13returnToThrowEPNS_9ExecStateEPNS_11InstructionE+0x4e) [0x7fc4d8e1df6e]
6 0x7fc4d8e2b33c /usr/lib/libjavascriptcoregtk-1.0.so.0(+0x23933c) [0x7fc4d8e2b33c]
7 0x7fc4d8e2ec59 /usr/lib/libjavascriptcoregtk-1.0.so.0(+0x23cc59) [0x7fc4d8e2ec59]

I tried it with a different gtk theme, and the same thing happened.

Related branches

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Hm, this isn't a particularly useful stack trace. This does not occur on my Kubuntu 12.10 amd64 system. Can you perhaps run 'exaile --debug' and post the log if it has anything useful in it? Also, the versions of your python, python-gtk, libwebkit, and python-webkit might be useful. The first two will be printed in exaile's log at the beginning of the logfile (located in ~/.local/share/exaile/logs/ ).

Another thought if you're a developer type is you could run exaile via python-dbg and catch the stack trace in GDB, would produce a better output.

Revision history for this message
Forest (foresto) wrote :

Running under python-dbg failed with the following error:
_glib.so: undefined symbol: Py_InitModule4_64

The output from running exaile --debug is attached...

Revision history for this message
Forest (foresto) wrote :

$ dpkg --list python python-gtk\* libwebkit\* python-webkit\*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==================================-======================-======================-==========================================================================
ii libwebkitgtk-1.0-0 1.10.0-0ubuntu1 amd64 Web content engine library for GTK+
ii libwebkitgtk-1.0-common 1.10.0-0ubuntu1 all Web content engine library for GTK+ - data files
ii libwebkitgtk-3.0-0 1.10.0-0ubuntu1 amd64 Web content engine library for GTK+
ii libwebkitgtk-3.0-common 1.10.0-0ubuntu1 all Web content engine library for GTK+ - data files
ii python 2.7.3-0ubuntu7 amd64 interactive high-level object-oriented language (default version)
ii python-gtk2 2.24.0-3build1 amd64 Python bindings for the GTK+ widget set
un python-gtk2-doc <none> (no description available)
un python-gtkglext1 <none> (no description available)
ii python-webkit 1.1.8-2ubuntu3 amd64 WebKit/Gtk Python bindings

Revision history for this message
Forest (foresto) wrote :

Is that what you needed?

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Sorry for missing the comment. No, the stack trace still isn't particularly useful.

The reason for the Py_InitModule4_64 error when running python-dbg is because you need the debug versions of any extensions Exaile uses installed also. So pygtk, gstreamer, etc must all have their -dbg versions installed in order for it to work correctly.

Revision history for this message
Forest (foresto) wrote :

Okay, I installed a big pile of -dbg packages and tried again. This time python-dbg didn't crash immediately, but when I opened exaile's Preferences dialog, I got a new crash with this message:

  Fatal Python error: gtktreeview.override:671 object at 0x68ad290 has negative ref count -1

That could be due to this bug:

  https://bugs.launchpad.net/ubuntu/+source/pygtk/+bug/1048105

I'm attaching the console output from this attempt.

Revision history for this message
Forest (foresto) wrote :

Here's the console output from running exaile --debug (without python-dbg). It contains everything from exaile.log plus a bit more backtrace info at the end.

Revision history for this message
Forest (foresto) wrote :

Here's the crash report file produced by apport.

By the way, I told apport to submit this crash report. Do these ever reach you?

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Yeah, the problem is the backtrace, in order to be useful, needs to have something that is in exaile or python GTK or something that we call and trace the problem to. Without that, it's pretty difficult to determine the problem.

I had forgotten about the python-dbg issue (note that I had filed that bug). :) If you follow the advice there, and remove the Py_DECREF(pypath) at line 671 of gtktreeview.override and recompile pygtk and install it, you can run Exaile in python-dbg without any problems.

Once you get it running inside gdb, you can use py-bt to get a python-related stack trace, and bt to get an actual stack trace. That might provide some insight as to what exactly is being called that is causing this problem.

Revision history for this message
Forest (foresto) wrote :

Ugh. What a hassle.
Is there nothing useful in that apport file?

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Oh, somehow we wrote a comment at the same time and I missed your comment. I haven't looked at the apport file... it might have something useful in it, I won't have time to look until maybe tomorrow or the next day. The apport files go to Ubuntu, and I'm not an ubuntu developer, so I don't ever see them. Presumably they do *something* with them.

Revision history for this message
Forest (foresto) wrote :

Okay, I patched python-gtk2 as you suggested and did another python-dbg run. This time, my attempt to enable contextinfo yielded a new undefined symbol error:

Traceback (most recent call last):
  File "/usr/lib/exaile/xl/plugins.py", line 122, in enable_plugin
    plugin = self.load_plugin(pluginname)
  File "/usr/lib/exaile/xl/plugins.py", line 84, in load_plugin
    plugin = imp.load_source(pluginname, os.path.join(path,'__init__.py'))
  File "/usr/share/exaile/plugins/contextinfo/__init__.py", line 21, in <module>
    import webkit
  File "/usr/lib/python2.7/dist-packages/webkit/__init__.py", line 21, in <module>
    import webkit
ImportError: /usr/lib/python2.7/dist-packages/webkit/webkit.so: undefined symbol: Py_InitModule4_64
WARNING : Unable to enable plugin contextinfo

That .so file is part of the python-webkit package, but I don't see any matching -dbg package in the repositores. If this is about debug symbols again, where am I supposed to get them?

Revision history for this message
Forest (foresto) wrote :

Also, have you had a chance to look at the apport file yet? I think there's a core dump in there.

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Sorry about the delay, I finally looked at the apport file you posted. It does have a stack trace in it -- in fact, it has a 1.2G core dump file inside it (compression is amazing sometimes!), but it's still not a particularly useful stack trace:

(gdb) bt
#0 0x00007f1ec0595704 in WTF::StringImpl::~StringImpl() () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#1 0x00007f1ec04be258 in JSC::hasErrorInfo(JSC::ExecState*, JSC::JSObject*) () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#2 0x00007f1ec03de3bd in JSC::Interpreter::throwException(JSC::ExecState*&, JSC::JSValue&, unsigned int) () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#3 0x00007f1ec03fc633 in JSC::genericThrow(JSC::JSGlobalData*, JSC::ExecState*, JSC::JSValue, unsigned int) () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#4 0x00007f1ec042af6e in JSC::LLInt::returnToThrow(JSC::ExecState*, JSC::Instruction*) () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#5 0x00007f1ec043833c in ?? () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#6 0x00007f1ec043bc59 in ?? () from /usr/lib/libjavascriptcoregtk-1.0.so.0
#7 0x00007f1e00000000 in ?? ()
#8 0x00007f1e78124100 in ?? ()
#9 0x0000000000000000 in ?? ()

Looking at this, my guess is that whatever page is being loaded by the context info plugin has some javascript that has script errors in it, but instead of handling it correctly it blows up. Since it's in a destructor, I can't help but wonder if the error is a threading error of some kind...

Maybe if you could somehow determine what page it was trying to render, then we could reproduce it by rendering the same page.

Revision history for this message
Forest (foresto) wrote :

Well, since the crash happens as soon as I click the Preferences > Plugins > Information > Contextual Info box to enable the plugin, I expect the plugin's author would be able to tell us what page it's trying to render. Who wrote it?

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Not sure. I expect that it will try to show some context for whatever track that you're currently viewing.

Revision history for this message
Forest (foresto) wrote :

That's the point I'm trying to make: I am not viewing any track when this happens. My playlist is completely empty, and nothing is playing. The crash occurs when I try to enable the contextinfo plugin, even though it doesn't appear that the plugin has anything to look up at that point. So, if it's trying to load a web page, I'm guessing the page is defined within the plugin itself. Does that point you in the right direction?

Revision history for this message
Forest (foresto) wrote :

This crash still occurs after upgrading my system to Xubuntu 13.04 (Raring).

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Without more information, I think we'll have to close this. Unfortunately, debugging python C module errors is a bit problematic.

Changed in exaile:
status: New → Incomplete
Revision history for this message
Forest (foresto) wrote :

Marking this report incomplete seems inappropriate, since the information most recently requested (the page that exaile loads without user input) ought to be available from the developer.

I have been and continue to be willing to gather whatever information can reasonably be gathered from an affected system. Just let me know what more information that is.

Changed in exaile:
status: Incomplete → New
Forest (foresto)
summary: - contextinfo plugin causes crash on ubuntu quantal amd64
+ contextinfo plugin causes exaile to crash
summary: - contextinfo plugin causes exaile to crash
+ enabling the contextinfo plugin causes exaile to crash
Revision history for this message
Forest (foresto) wrote :

The problem persists on Xubuntu 13.10 (Saucy) amd64, so I'm revisiting this now that I've upgraded to that release.

I tried again to run with gdb and python-dbg, but even after installing all the -dbg packages of all the library dependencies I could find, import webkit failes with this error:
ImportError: /usr/lib/python2.7/dist-packages/webkit/webkit.so: undefined symbol: Py_InitModule4_64
Since there is no python-webkit-dbg package in the ubuntu repositories, I have filed a bug report:
https://bugs.launchpad.net/ubuntu/+source/pywebkitgtk/+bug/1247657

Your comment that the crash in a libjavascriptcoregtk destructor might indicate a threading error seems reasonable to me. I just came across this post from someone else who had crash problems when creating and modifying a WebView from different threads:
http://stackoverflow.com/questions/11921631/uiwebview-ios-5-webkit-javascriptcore-crash/15524089#15524089

If the crash is triggered by the contextinfo plugin running javascript, it must be a static .js file that comes with the plugin, not a web site. (This is a reasonable assumption because the crash occurs the moment I click the contextinfo plugin check box, while exaile has an empty playlist and is not playing anything, and even when I have no internet connection and no songs in my library.)

Digging into the contextinfo code a bit, I see that it loads some static web pages from /usr/share/exaile/plugins/contextinfo/classic/ that include a javascript file called js/util.js. So, if you're interested in what javascript might be triggering the crash, that seems to be the place to look. Here it is:
http://bazaar.launchpad.net/~exaile-devel/exaile/trunk/view/head:/plugins/contextinfo/classic/js/util.js

Does that help?

Revision history for this message
Forest (foresto) wrote :

For what it's worth, this is easily reproducible. I just started the xubuntu 13.10 amd64 live CD in virtualbox, installed exaile and exaile-plugin-contextinfo, and tried enabling the plugin. Exaile crashed immediately, just as it does on my real hardware.

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

Just with the LiveCD + vbox? Hm.. ok. I'll put it on my agenda for this month, and see what I can see.

Revision history for this message
Forest (foresto) wrote :

Yep. I had VirtualBox 4.2.16 create an Ubuntu (64 bit) VM using default settings (with 1 CPU) and adjusted RAM size to 2GB. I booted the xubuntu-13.10-desktop-amd64.iso DVD image, selected Try Xubuntu, and opened a terminal window when the desktop appeared. I ran sudo apt-get install exaile exaile-plugin-contextinfo && exaile, then opened the Plugins section of the Preferences window, and clicked the Enabled box next to the Contextual Info plugin. Exaile immediately went unresponsive and dumped crash output to the terminal. Its GUI disappeared a few seconds later, leaving a backtrace of libjavascriptcoregtk calls in the terminal window.

Thanks, Dustin!

Revision history for this message
Dustin Spicuzza (dustin-virtualroadside) wrote :

FYI: I just ran into this crash on Fedora 20. It was executing a script on a different thread. I pushed a fix into the 3.3.x branch, and it'll be integrated into trunk for the upcoming 3.4 release. Sorry about the delay.

Changed in exaile:
milestone: none → 3.4.0
assignee: nobody → Dustin Spicuzza (dustin-virtualroadside)
status: New → Fix Committed
Changed in exaile:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.