update-manager crashed with AttributeError in check_hovering(): 'tuple' object has no attribute 'get_tags'

Bug #1548425 reported by Edson T. Marques on 2016-02-22
112
This bug affects 23 people
Affects Status Importance Assigned to Milestone
Ubuntu GNOME
Undecided
Unassigned
update-manager (Ubuntu)
Medium
Unassigned
Xenial
Medium
Brian Murray
Yakkety
Medium
Unassigned

Bug Description

Impact
------
We are receiving thousands of crash reports regarding update-manager when it is used in conjunction with the gnome3-team ppa which provides a new version of gtk3. Here is the Errors Bucket:

https://errors.ubuntu.com/bucket/?id=/usr/bin/update-manager%3AAttributeError%3Avisibility_notify_event%3Acheck_hovering

Test Case
---------
On an Ubuntu 16.04 system
1) sudo add-apt-repository ppa:gnome3-team/gnome3-staging
2) sudo apt-get update
3) sudo apt-get upgrade
4) reboot
5) downgrade whoopsie (sudo apt-get install whoopsie=0.2.52 libwhoopsie0=0.2.52)
6) open a terminal
7) run update-manager
8) observe Traceback re: "AttributeError: '_ResultTuple' object has no attribute 'get_tags'

With the version of the package from -proposed you will no longer receive a traceback.

We can also verify that the bucket at the Ubuntu Error Tracker does not contain the new version of update-manager in the versions table.

Regression Potential
--------------------
Little given that the patch uses a try / except handler for the AttributeError. That being said we should try installing the version of update-manager from -proposed on a system without the new version of gtk3 and upgrading packages.

Unexpectedly crash on close.

ProblemType: CrashDistroRelease: Ubuntu 16.04
Package: update-manager 1:15.10.3
ProcVersionSignature: Ubuntu 4.4.0-7.22-generic 4.4.2
Uname: Linux 4.4.0-7-generic x86_64
ApportVersion: 2.20-0ubuntu3
Architecture: amd64
CrashCounter: 1
CurrentDesktop: GNOME
Date: Mon Feb 22 14:36:11 2016
ExecutablePath: /usr/bin/update-manager
GsettingsChanges:
 b'com.ubuntu.update-manager' b'show-details' b'true'
 b'com.ubuntu.update-manager' b'window-height' b'733'
 b'com.ubuntu.update-manager' b'first-run' b'false'
 b'com.ubuntu.update-manager' b'window-width' b'817'
 b'com.ubuntu.update-manager' b'launch-time' b'1456162554'
InstallationDate: Installed on 2015-11-10 (104 days ago)
InstallationMedia: Ubuntu-GNOME 16.04 LTS "Xenial Xerus" - Alpha amd64 (20151108)
InterpreterPath: /usr/bin/python3.5
PackageArchitecture: all
ProcCmdline: /usr/bin/python3 /usr/bin/update-manager
ProcEnviron:
 LANGUAGE=pt_BR:pt:en
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=pt_BR.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/update-manager']SourcePackage: update-manager
Title: update-manager crashed with AttributeError in check_hovering(): 'tuple' object has no attribute 'get_tags'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm audio bluetooth cdrom clamav dip firebird gdm lp lpadmin plugdev pulse sambashare src ssh sudo tty users utmp uucp uuidd vboxusers video www-data

Related branches

tags: removed: need-duplicate-check
Changed in update-manager (Ubuntu):
importance: Undecided → Medium
Brian Murray (brian-murray) wrote :

This happens in the following function:

251 def check_hovering(self, x, y):
252 """Check if the mouse is above a tagged link and if yes show
253 a hand cursor"""
254 _hovering = False

I hovered over a link in the changelog for a package in update-manager without an issue. I'm using the Unity desktop environment and update-manager version 1:15.10.3.

information type: Private → Public
Brian Murray (brian-murray) wrote :

Can you recreate this by viewing changelogs and hovering over links?

Changed in update-manager (Ubuntu):
status: New → Incomplete
Xosé (ubuntu-galizaweb) wrote :

I can't see the Changes/Description panel - just a horizontal line. Might this happen when I hover over it and try to open it? Check out the screenshot.

Xosé (ubuntu-galizaweb) wrote :

It crashes as it finishes checking for updates.

Xosé (ubuntu-galizaweb) wrote :

It hasn't crashed today but the panel I mentioned at #4 (Changes / Description) opens just two lines of text when it should grow to occupy the space needed. Check out the screenshot.

Same error crash as it finishes checking for updates.

seems to affect me too

Getting this bug daily

Marius Gedminas (mgedmin) wrote :

The crash is in the following code:

    def check_hovering(self, x, y):
        """Check if the mouse is above a tagged link and if yes show
           a hand cursor"""
        _hovering = False
        # get the iter at the mouse position
        iter = self.get_iter_at_location(x, y)

        # set _hovering if the iter has the tag "url"
        tags = iter.get_tags()

The error is "AttributeError: '_ResultTuple' object has no attribute 'get_tags'".

self is an instance of a subclass of Gtk.TextView, which has a `get_iter_at_location()` method that returns a tuple (bool, iterator): http://lazka.github.io/pgi-docs/#Gtk-3.0/classes/TextView.html#Gtk.TextView.get_iter_at_location

(I'm guessing PyGTK used to return just the iterator (or None), but with the migration to PyGObject + gobject-introspection + GTK+ 3.x this changed.)

Suggested fix: iter = self.get_iter_at_location(x, y)

This buggy code pattern is also repeated in button_press_event.

Marius Gedminas (mgedmin) wrote :

Oops, I meant

  Suggested fix: iter = self.get_iter_at_location(x, y)[1]

but the [1] got lost somehow (accidental ^Z I bet).

Marius Gedminas (mgedmin) wrote :

Here's a patch that ought to fix this.

Marius Gedminas (mgedmin) wrote :

Steps to reproduce:

1. Open terminal
2. Run 'update-manager'
3. Wait for it to finish checking for updates

This bug results in the following error being printed to the terminal, possibly several times:

    Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/UpdateManager/ChangelogViewer.py", line 248, in visibility_notify_event
        self.check_hovering(bx, by)
      File "/usr/lib/python3/dist-packages/UpdateManager/ChangelogViewer.py", line 259, in check_hovering
        tags = iter.get_tags()
    AttributeError: '_ResultTuple' object has no attribute 'get_tags'

BTW the update-manager window does not disappear and continues to be functional, despite this error.

Marius Gedminas (mgedmin) wrote :
Sebastien Bacher (seb128) wrote :

You have gtk 3.19 from a ppa, seems like the issue is that the function signature changed in that update ... the bug doesn't impact Ubuntu proper yet but is going to once gtk is updated, meanwhile that's an Ubuntu GNOME issue

Changed in update-manager (Ubuntu):
status: Incomplete → New
no longer affects: update-manager

The attachment "fix-lp1548425.debdiff" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in update-manager (Ubuntu):
status: New → Confirmed
Changed in update-manager (Ubuntu):
status: Confirmed → Triaged
tags: added: yakkety
Sebastien Bacher (seb128) wrote :

unsubscribing sponsors, the change is wrong for Ubuntu and concerns a ppa version of gtk

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-manager - 1:16.10.4

---------------
update-manager (1:16.10.4) yakkety; urgency=medium

  * ChangelogViewer: Fix an API call to work with GTK < and ≥ 3.20. Upstream
    gave gtk_text_view_get_iter_at_location a gboolean return type, which
    makes gobject-introspection return (return value, out parameter). (LP:
    #1548425)
  * ChangelogViewer: Set vexpand so that the changelog TextView takes up all
    the remaining vertical space.

 -- Iain Lane <email address hidden> Fri, 29 Jul 2016 11:15:54 +0100

Changed in update-manager (Ubuntu Yakkety):
status: Triaged → Fix Released
Changed in ubuntu-gnome:
status: New → Confirmed
Bill Turner, wb4alm (wb4alm) wrote :

This is still a problem in gnome 3.20

problem occurs daily.

manual restart of update-manger allows update-manager to function correctly.

chris pollock (cpollock) wrote :

I currently have version:

chris@localhost:~$ apt-cache policy update-manager
update-manager:
  Installed: 1:16.04.4
  Candidate: 1:16.04.4
  Version table:
 *** 1:16.04.4 500
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
        100 /var/lib/dpkg/status
     1:16.04.3 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu xenial/main i386 Packages

with Gnome

chris@localhost:~$ apt-cache policy gdm3
gdm3:
  Installed: 3.20.1-1ubuntu2~ubuntu16.04.1
  Candidate: 3.20.1-1ubuntu2~ubuntu16.04.1
  Version table:
 *** 3.20.1-1ubuntu2~ubuntu16.04.1 500
        500 http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status
     3.18.3-0ubuntu2 500
        500 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages

and got the software-updater crash a few minutes ago.

chris pollock (cpollock) wrote :

Additional info, actually update-manager doesn't crash as software-updater is still active.

chris pollock (cpollock) wrote :

This is still not fixed in 16.04.1 LTS apparently as it has just happened again and as I've said before update-manager doesn't actually crash AFAICT.

Brian Murray (brian-murray) wrote :

The reason this wasn't fixed in Ubuntu 16.04 is because it doesn't affect the proper Ubuntu archive, rather only users who have the gnome3 ppa enabled which provides a newer version of gtk. That being said given that there are tens of thousands of reports about this at the Error Tracker let's get this fixed.

Changed in update-manager (Ubuntu Xenial):
assignee: nobody → Brian Murray (brian-murray)
importance: Undecided → Medium
status: New → In Progress
description: updated
Bill Turner, wb4alm (wb4alm) wrote :

Like I said several months ago..

"This is still a problem in gnome 3.20

problem occurs daily.

manual restart of update-manger allows update-manager to function..."

Hello Edson, or anyone else affected,

Accepted update-manager into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/update-manager/1:16.04.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in update-manager (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Brian Murray (brian-murray) wrote :

I recreated this error by following the test case provided, I then installed python3-update-manager, update-manager and update-manager-core version 1:16.04.5 and no longer received the Traceback. Setting to verification-done.

tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package update-manager - 1:16.04.5

---------------
update-manager (1:16.04.5) xenial; urgency=medium

  [ Iain Lane ]
  * ChangelogViewer: Fix an API call to work with GTK < and ≥ 3.20. Upstream
    gave gtk_text_view_get_iter_at_location a gboolean return type, which
    makes gobject-introspection return (return value, out parameter). (LP:
    #1548425)

 -- Brian Murray <email address hidden> Mon, 19 Dec 2016 13:46:30 -0800

Changed in update-manager (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for update-manager has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers