Error launching host dialog: 'NoneType' object has no attribute '__getitem__'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
virt-manager (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Christian Ehrhardt |
Bug Description
[Impact]
* There is a potential race why the async availability of an Object might
lead to an access of a None object and fail virt-manager.
* The fix just makes sure this cases is avoided by checking the type
upfront.
* Slow remote connections are assumed to increase the window for this
race, but so far it seems rare and barely reproducible.
[Test Case]
* This is hard - sorry. While in theory it seems clear what happens
(self._hostinfo is None) it is hard to provike that. But OTOH people
have hit it in the field, so we want to fix it.
Given the very small change I'd ask you to review it on the code level
instead of testing.
* If one insists on testing create a bunch of slow conenctions to remote
ssh libvirtd. And iterate connecting to those remotes. But so far I
wan't able to trigger it that way (more tests, slower connection, more
bad luck needed).
[Regression Potential]
* Just adding an extra sanity check before accessing an (otherwise)
potentially None Object IMHO poses no extra regression risk.
[Other Info]
* n/a
---
I launched virt-manager and connected to libvirtd running on a local server via an SSH connection. I got an unexpected error dialog
Error launching host dialog: 'NoneType' object has no attribute '__getitem__'
I have a screenshot of the last part of the traceback (attached), but unfortunately I didn't think to copy it as text, and I can no longer reproduce the error. I'll retype the last frame a least:
File "/usr/share/
return self._hostinfo[1] * 1024
TypeError: 'NoneType' object has no attribute '__getitem__'
After I dismissed the error dialog, everything seemed to be working just fine -- I could see the VMs and connect to them.
ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: virt-manager 1:1.5.1-0ubuntu1
ProcVersionSign
Uname: Linux 4.15.0-34-generic x86_64
NonfreeKernelMo
ApportVersion: 2.20.9-0ubuntu7.3
Architecture: amd64
CurrentDesktop: GNOME
Date: Tue Sep 25 18:20:39 2018
InstallationDate: Installed on 2016-09-10 (745 days ago)
InstallationMedia: Ubuntu-GNOME 16.04.1 LTS "Xenial Xerus" - Release amd64 (20160720)
PackageArchitec
SourcePackage: virt-manager
UpgradeStatus: Upgraded to bionic on 2018-04-27 (151 days ago)
Related branches
- Andreas Hasenack: Approve
- Canonical Server: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 74 lines (+52/-0)3 files modifieddebian/changelog (+8/-0)
debian/patches/lp-1794315-connection-avoid-failing-on-NoneType.patch (+43/-0)
debian/patches/series (+1/-0)
- Robie Basak: Approve
- Canonical Server: Pending requested
- git-ubuntu developers: Pending requested
-
Diff: 140 lines (+112/-0)4 files modifieddebian/changelog (+10/-0)
debian/patches/lp-1794315-connection-avoid-failing-on-NoneType.patch (+43/-0)
debian/patches/lp-1796932-tests-osdict-fix-ordering-issue-with-new-osinfo.patch (+57/-0)
debian/patches/series (+2/-0)
Changed in virt-manager (Ubuntu Bionic): | |
status: | New → Triaged |
description: | updated |
Changed in virt-manager (Ubuntu Bionic): | |
assignee: | nobody → Christian Ehrhardt (paelzer) |
status: | Triaged → In Progress |
_hostinfo is initialized as None
connection. py:__init_ _:236 self._hostinfo = None
The code that fails has a check on backend is open to be sure it is initialized. py:_tick: 1331 self._hostinfo = self._backend. getInfo( )
And the init of that value is at
connection.
This polls for new objects regularly.
There might be a race of the backend being opened, but no updates yet completed.
That might be more likely for a more remote connection that is slow, but local ssh sounds fast.
A safety check to not be None might be worth to be added just to be sure.