apt-avahi-discover script uses deprecated asyncore module

Bug #1963794 reported by Rolf Leggewie
110
This bug affects 20 people
Affects Status Importance Assigned to Milestone
squid-deb-proxy (Debian)
Confirmed
Unknown
squid-deb-proxy (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

On Jammy, I'm getting the following warning on the console:

$ /usr/share/squid-deb-proxy-client/apt-avahi-discover
/usr/share/squid-deb-proxy-client/apt-avahi-discover:6: DeprecationWarning: The asyncore module is deprecated. The recommended replacement is asyncio
  import asyncore

Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in squid-deb-proxy (Ubuntu):
status: New → Confirmed
Revision history for this message
Jeffrey Peninger (jeffp) wrote :
Revision history for this message
Norbert (nrbrtx) wrote :

Then SRU is needed.

Revision history for this message
Jeffrey Peninger (jeffp) wrote (last edit ):

SRU - Someone Really Useful? I am a noob who is good at research but point me in the right direction and I'll try and figure it out.

Revision history for this message
Norbert (nrbrtx) wrote :
Revision history for this message
Jeffrey Peninger (jeffp) wrote (last edit ):

Well, he's a member of Conanical, all I could do is get in the way, well above my paygrade.. LOL

But thanks for the information, it gives me a better understanding of how this works!

Revision history for this message
Carl Karsten (carlfk) wrote :

If someone will point me to a "how to submit patch" howto, I'll submit a patch.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

@Carl, the first step is to fix this problem in the current development release.

I have backported the latest upstream apt-avahi-discover script to lunar. I also compiled the package for jammy and it works fine. Feel free to get the fixed package for jammy and later from my stable LTS support PPA.

@sponsors, please consider to upload the following debdiff to lunar

Revision history for this message
Alex Murray (alexmurray) wrote :

I have just sponsored your debdiff to lunar - thanks @r0lf

Changed in squid-deb-proxy (Debian):
status: Unknown → Confirmed
Revision history for this message
Rolf Leggewie (r0lf) wrote :

Thanks, Alex. Much appreciated!

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package squid-deb-proxy - 0.8.15+nmu1ubuntu2

---------------
squid-deb-proxy (0.8.15+nmu1ubuntu2) lunar; urgency=medium

  * backport latest apt-avahi-discover from upstream commit
    42fe9174a408436329e8a0b8b48fb19b2d000d4d
    - fix flake8 style errors
    - transition from asyncore to asyncio (LP: #1963794)

 -- Rolf Leggewie <email address hidden> Wed, 04 Jan 2023 10:53:24 +0800

Changed in squid-deb-proxy (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Rolf Leggewie (r0lf) wrote (last edit ):

I run this updated package recompiled in jammy. I believe the fix might introduce a regression from upstream. Reopening for verification in lunar.

I run an instance of apt-cacher-ng on my local machine. When the instance is active, things are great. When I turn it off with "sudo service apt-cacher-ng stop" and then run the /usr/share/squid-deb-proxy-client/apt-avahi-discover script, I get the following error. This does not happen with the package still using asyncore. Can somebody please verify?

$ /usr/share/squid-deb-proxy-client/apt-avahi-discover
Traceback (most recent call last):
  File "/usr/share/squid-deb-proxy-client/apt-avahi-discover", line 148, in <module>
    address = get_proxy_host_port_from_avahi()
  File "/usr/share/squid-deb-proxy-client/apt-avahi-discover", line 131, in get_proxy_host_port_from_avahi
    asyncio.run(asyncio.wait_for(gather_hosts(), timeout=timeout))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 646, in run_until_complete
    return future.result()
  File "/usr/lib/python3.10/asyncio/tasks.py", line 445, in wait_for
    return fut.result()
  File "/usr/share/squid-deb-proxy-client/apt-avahi-discover", line 128, in gather_hosts
    await asyncio.gather(*[h.time_connect() for h in hosts])
  File "/usr/share/squid-deb-proxy-client/apt-avahi-discover", line 51, in time_connect
    reader, writer = await asyncio.open_connection(
  File "/usr/lib/python3.10/asyncio/streams.py", line 47, in open_connection
    transport, _ = await loop.create_connection(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1064, in create_connection
    raise exceptions[0]
  File "/usr/lib/python3.10/asyncio/base_events.py", line 1049, in create_connection
    sock = await self._connect_sock(
  File "/usr/lib/python3.10/asyncio/base_events.py", line 960, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 500, in sock_connect
    return await fut
  File "/usr/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('172.17.0.1', 3142)

Changed in squid-deb-proxy (Ubuntu):
status: Fix Released → Confirmed
tags: added: lunar regression-release
Revision history for this message
Rolf Leggewie (r0lf) wrote :

Regression confirmed by Gunnar in lunar in bug 2002562 comment 2

Revision history for this message
Rolf Leggewie (r0lf) wrote :

There is a fix to the regression available and I verified it does the job at least in my case

https://github.com/mvo5/squid-deb-proxy/pull/9

Revision history for this message
Rolf Leggewie (r0lf) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package squid-deb-proxy - 0.8.15+nmu1ubuntu4

---------------
squid-deb-proxy (0.8.15+nmu1ubuntu4) lunar; urgency=medium

  * fix regression from LP: #1963794 with patch from Jesse McDonald

 -- Rolf Leggewie <email address hidden> Sat, 21 Jan 2023 09:39:59 +0100

Changed in squid-deb-proxy (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Alex Lane (modem7) wrote (last edit ):

Will this fix be rolled out to jammy?

I can confirm that 0.8.15+nmu1ubuntu4 works on 22.04.2.

Testing done:
wget https://launchpad.net/ubuntu/+archive/primary/+files/squid-deb-proxy-client_0.8.15+nmu1ubuntu4_all.deb
apt-get install ./squid-deb-proxy-client_0.8.15+nmu1ubuntu4_all.deb
reboot now

/usr/share/squid-deb-proxy-client/apt-avahi-discover
http://192.168.50.101:3142/

Revision history for this message
Norbert (nrbrtx) wrote :

Please upload this fixed package to the upcoming Debian 12 (bookworm) repository.

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

Duplicates of this bug

Other bug subscribers

Remote bug watches

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