Avahi service for squid-deb-proxy does not start

Bug #666014 reported by Bartek Celary on 2010-10-24
48
This bug affects 10 people
Affects Status Importance Assigned to Milestone
squid-deb-proxy (Ubuntu)
Medium
Unassigned
Lucid
Undecided
Unassigned
Maverick
Medium
Unassigned
Natty
Medium
Unassigned

Bug Description

TEST CASE:
1. use maverick
2. install squid-deb-proxy
3. reboot
4. run "sudo service squid-deb-proxy-avahi status"
5. verify that its in state stop/waiting

6. install squid-deb-proxy from maverick-proposed
7. reboot
8. repeat step 4
9. verify that its in state start/running now

Binary package hint: squid-deb-proxy

Here's the summary of the problem after system startup:

% sudo service squid-deb-proxy status
squid-deb-proxy start/running, process 1297

% sudo service squid-deb-proxy-avahi status
squid-deb-proxy-avahi stop/waiting

As we see the squid-deb-proxy avahi advertiser does not start and no machine can see we have a deb proxy around. Both dependencies (avahi and squid-deb-proxy services) are running in my case. If I do 'service squid-deb-proxy-avahi start' it goes up without a problem... I have worked around it so the upstart script starts the advertising without squid going up but this is not a solution obviously. I've tried to check what could be wrong with the upstart script but there does not appear to be any good documentation or manual for upstart scripting... thus I have no clue why the script fails to start squid-deb-proxy-avahi... Here's how it looks:

description "squid-deb-proxy-avahi"

start on (squid-deb-proxy and avahi-daemon)
stop on stopping squid-deb-proxy

# get it back with
# avahi-browse -prt _apt_proxy._tcp
script
  PORT=$(grep http_port /etc/squid-deb-proxy/squid-deb-proxy.conf|cut -d' ' -f2)
  if [ -n "$PORT" ] && [ -x /usr/bin/avahi-publish ]; then
    exec avahi-publish -s "Squid deb proxy" _apt_proxy._tcp $PORT
  fi
end script%

Carl Karsten (carlfk) wrote :

I am guessing this is the same bug:

It doesn't start when squid-deb-proxy is started:

# current status is running - good.
juser@g2:~$ sudo service squid-deb-proxy-avahi status
squid-deb-proxy-avahi start/running, process 2848

# stop squid-deb-proxy
juser@g2:~$ sudo service squid-deb-proxy stop
squid-deb-proxy stop/waiting

# -avahi stopped - good.
juser@g2:~$ sudo service squid-deb-proxy-avahi status
squid-deb-proxy-avahi stop/waiting

# start squid-deb-proxy
juser@g2:~$ sudo service squid-deb-proxy start
squid-deb-proxy start/running, process 2903

# -avahi still stopped - bad
juser@g2:~$ sudo service squid-deb-proxy-avahi status
squid-deb-proxy-avahi stop/waiting

# it does start ok:
juser@g2:~$ sudo service squid-deb-proxy-avahi start
squid-deb-proxy-avahi start/running, process 2913

Michael Vogt (mvo) on 2010-11-10
Changed in squid-deb-proxy (Ubuntu Maverick):
status: New → Confirmed
importance: Undecided → Medium
Changed in squid-deb-proxy (Ubuntu Natty):
status: New → Confirmed
importance: Undecided → Medium
Michael Vogt (mvo) on 2010-11-10
Changed in squid-deb-proxy (Ubuntu Natty):
status: Confirmed → Fix Committed
Changed in squid-deb-proxy (Ubuntu Maverick):
milestone: none → maverick-updates
Michael Vogt (mvo) on 2010-11-10
Changed in squid-deb-proxy (Ubuntu Natty):
status: Fix Committed → Fix Released
Michael Vogt (mvo) on 2010-11-10
Changed in squid-deb-proxy (Ubuntu Maverick):
status: Confirmed → In Progress
description: updated

Accepted squid-deb-proxy into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in squid-deb-proxy (Ubuntu Maverick):
status: In Progress → Fix Committed
tags: added: verification-needed
Martin Pitt (pitti) wrote :

Since upstart events are a bit tricky in this regard, verification of this should also confirm that you can upgrad the squid-deb-proxy package without the postinst hanging forever. I. e. first upgrade from the maverick to the -proposed version, and then do

  sudo apt-get install --reinstall squid-deb-proxy

The reason is that if avahi is already running, you will not get a "started avahi" event, so if squid-deb-proxy's postinst tries to restart the daemon, then it might be stuck waiting for an event which will never happen.

Clint Byrum (clint-fewbar) wrote :

In trying to run the test case for this, I didn't get the squid-deb-proxy service started, with 0.3.1 or 0.3.1.1

This is because squid needs the network up to do DNS lookups... it fails with:

2010/11/15 18:10:19| Starting Squid Cache version 2.7.STABLE9 for x86_64-debian-linux-gnu...
2010/11/15 18:10:19| Process ID 1653
2010/11/15 18:10:19| With 1024 file descriptors available
2010/11/15 18:10:19| Using epoll for the IO loop
2010/11/15 18:10:19| Performing DNS Tests...
FATAL: ipcache_init: DNS name lookup tests failed.
Squid Cache (Version 2.7.STABLE9): Terminated abnormally.
CPU Usage: 0.000 seconds = 0.000 user + 0.000 sys
Maximum Resident Size: 7216 KB
Page faults with physical i/o: 0

If I manually start squid-deb-proxy *after* the wifi associates (no wired connection here) then it works fine.

so the job cannot be

start on runlevel [2345]

It should be (as squid is)

start on (local-filesystems and net-device-up IFACE!=lo)

Testing with this modification seems to produce the desired result with 0.3.1.1's upstart job.

So I'd say this SRU should also include this modification to /etc/init/squid-deb-proxy.conf before moving to -updates

should we open a separate report for that

johnf (johnfzc) wrote :

I'd like to further add that these issues don't just affect package installation but the avahi service after a restart of the underlying squid service.

With everything running and started normally, if you run the command:

sudo restart squid-deb-proxy

The squid-deb-proxy-avahi service will go down and not come back up.

It needs to be manually started after the restart completes with:

sudo start squid-deb-proxy-avahi

Clint Byrum (clint-fewbar) wrote :

johnf, good point. This is, I believe, related to bug #447654 which affects any usage of the 'and' operator in upstart. Because we hit the 'stopping squid-deb-proxy' event, we stopped, then we got the 'started squid-deb-proxy' event, but we have to wait for the 'started avahi-daemon' event, which won't come until we restart avahi-daemon.

The workaround is to change

stop on stopping squid-deb-proxy

to

stop on stopped squid-deb-proxy

Since this event is only emitted when the job is actually stopped, and not when it is restarted.

Its not perfect, as it means there will be a brief period of time where the avahi publish will be broadcasting about a squid that is shutting down.

Clint Byrum (clint-fewbar) wrote :

Note that I think the problems identified were different than this issue, so I created a new bug report here:

https://bugs.launchpad.net/ubuntu/+source/squid-deb-proxy/+bug/677276

Which I've submitted a merge proposal for.

Id2ndR (id2ndr) wrote :

The bug is present in Lucid too.

Martin Pitt (pitti) wrote :

Accepted squid-deb-proxy into maverick-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Martin Pitt (pitti) wrote :

Accepted squid-deb-proxy into lucid-proposed, the package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in squid-deb-proxy (Ubuntu Lucid):
status: New → Fix Committed

Looks like from the service perspective it is working fine. Both services
got up and running without issue.

However in my case I had to purge/reinstall avahi-* stuff to get avahi
discovery working properly.

Thanks for the fix.

On 7 January 2011 09:50, Martin Pitt <email address hidden> wrote:

> Accepted squid-deb-proxy into lucid-proposed, the package will build now
> and be available in a few hours. Please test and give feedback here. See
> https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to
> enable and use -proposed. Thank you in advance!
>
> ** Changed in: squid-deb-proxy (Ubuntu Lucid)
> Status: New => Fix Committed
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/666014
>
> Title:
> Avahi service for squid-deb-proxy does not start
>

--
Bartek Celary

Martin Pitt (pitti) on 2011-01-15
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package squid-deb-proxy - 0.3.1.0.1

---------------
squid-deb-proxy (0.3.1.0.1) lucid-proposed; urgency=low

  * debian/squid-deb-proxy.squid-deb-proxy-avahi.upstart,
    debian/squid-deb-proxy.upstart:
    - backport upstart script fixes from natty so that the avahi
      service gets started and stopped correctly and that squid
      only starts when there is a network interface available
      (LP: #666014)
  * mirror-dstdomain.acl:
    - include extras.ubuntu.com and archive.canonical.com in the
      default configuration to make it work out-of-the box with
      maverick clients
 -- Michael Vogt <email address hidden> Thu, 06 Jan 2011 16:58:31 +0100

Changed in squid-deb-proxy (Ubuntu Lucid):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package squid-deb-proxy - 0.3.1.2

---------------
squid-deb-proxy (0.3.1.2) maverick-proposed; urgency=low

  * debian/squid-deb-proxy.squid-deb-proxy-avahi.upstart,
    debian/squid-deb-proxy.upstart:
    - backport upstart script fixes from natty so that the avahi
      service gets started and stopped correctly and that squid
      only starts when there is a network interface available
      (LP: #666014)
 -- Michael Vogt <email address hidden> Mon, 03 Jan 2011 16:40:09 +0100

Changed in squid-deb-proxy (Ubuntu Maverick):
status: Fix Committed → Fix Released
tags: added: testcase
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers