avahi-browse makes host completion ugly and slow

Bug #510591 reported by Chris Jones on 2010-01-21
This bug affects 3 people
Affects Status Importance Assigned to Milestone
bash-completion (Debian)
Fix Released
bash-completion (Ubuntu)

Bug Description

Binary package hint: bash-completion

The latest version of bash-completion, synced into lucid, calls the following from /etc/bash-completion in _known_hosts_real():

avahi-browse -cpr _workstation._tcp

which is probably great on a small home network with 2 machines. However, there are typically over 100 Avahi/Bonjour devices on the same broadcast network as my laptop, and because they are generally laptops they are appearing and disappearing on the network very frequently, which means avahi will often hit its internal timeouts when trying to resolve things that are going away. This adds up to the above avahi-browse command always taking at least 5 seconds, which is really quite a lot of time to add to a tab completion.

Secondly, something is wrong with the way it is being called, as the first thing it always prints, to stderr, is:

WARNING: Unhandled message: interface=org.freedesktop.DBus.Introspectable, path=/, member=Introspect

(stderr is not redirected away by the bash-completion script). Depending on how many hosts have timed out, I will then get for each one, an error like:

Failed to resolve service 'bob-laptop [00:11:22:33:44:55]' of type '_workstation._tcp' in domain 'local': Timeout reached

All in all this makes for a very unpleasant experience if you are a sysadmin who uses ssh constantly!

avahi is a great feature, but please make this silent and optional for those of us whom it hurts!

ProblemType: Bug
Architecture: amd64
Date: Thu Jan 21 11:12:20 2010
DistroRelease: Ubuntu 10.04
EcryptfsInUse: Yes
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release Candidate amd64 (20091020.3)
Package: bash-completion 1:1.1-3
PackageArchitecture: all
 PATH=(custom, user)
ProcVersionSignature: Ubuntu 2.6.32-11.15-generic
SourcePackage: bash-completion
Uname: Linux 2.6.32-11-generic x86_64

Chris Jones (cmsj) wrote :
Chris Jones (cmsj) on 2010-01-21
summary: - avahi-browse makes host completion ugly, slow and broken
+ avahi-browse makes host completion ugly and slow
description: updated
Chris Jones (cmsj) on 2010-03-22
Changed in bash-completion (Ubuntu):
status: New → Confirmed
Jimmy Hedman (jimmy-hedman) wrote :

Also, when machines come and go it works pretty bad to, even on a small network. I have network with 3 machines and if I try to tab-complete ssh when my wife just have turned of here computer I get a ugly error message.
Could you please remove this feature or at least make it configurable?

Eyad Salah (eyad-salah) wrote :

I just tried reinstalling avahi-utils and avahi-daemon and everything works fine now

Changed in bash-completion (Debian):
status: Unknown → Confirmed

I also just did this and everything works fine now:
apt-get install --reinstall avahi-utils avahi-daemon

$ dpkg -l|grep '\bavahi'
ii avahi-autoipd 0.6.25-1ubuntu6 Avahi IPv4LL network address configuration daemon
ii avahi-daemon 0.6.25-1ubuntu6 Avahi mDNS/DNS-SD daemon
ii avahi-utils 0.6.25-1ubuntu6 Avahi browsing, publishing and discovery utilities
ii python-avahi 0.6.25-1ubuntu6 Python utility package for Avahi

...and 45 minutes later the error messages are back.

Chris Jones (cmsj) wrote :

I've linked a branch which contains a patch to comment out the avahi-browse call. The upstream fix to run it in a subshell with a strict timeout looks interesting, but hasn't been accepted upstream yet, so I don't think it's suitable to wedge into Lucid at this point.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package bash-completion - 1:1.1-3ubuntu2

bash-completion (1:1.1-3ubuntu2) lucid; urgency=low

  * debian/patches/support_multiple_hosts_files.diff:
    Fix external ssh known_hosts files (LP: #483499)
  * debian/patches/disable-avahi-browse.diff:
    Disable avahi-browse since it scales poorly in the current
    form. (LP: #510591)
 -- Chris Jones <email address hidden> Wed, 14 Apr 2010 10:26:41 +0100

Changed in bash-completion (Ubuntu):
status: Confirmed → Fix Released
MestreLion (mestrelion) wrote :

Too bad the patch entirely removed avahi-browser , instead of using upstream techniques (strict timeout, silent subshell, etc) to make it work properly (or minize the issues). Now ssh tab completion is *useless*, since ~/.ssh/known_hosts is hashed and /etc/hosts is usually empty. avahi-brower was the only source of useful lists.

It also affects all other tab completions that rely on _known_hosts_real(), like ping. They are all useless now.

It should at least have made it optional. Lazy lazy patch...

Changed in bash-completion (Debian):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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