[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-05-17 Thread Launchpad Bug Tracker
This bug was fixed in the package python-aiohttp - 3.6.2-1ubuntu1

---
python-aiohttp (3.6.2-1ubuntu1) focal; urgency=medium

  * Backport upstream patch to fix resolver tasks not awaited on cancellation
(LP: #1969817)

 -- Olivier Gayot   Thu, 22 Apr 2022
18:25:22 +0200

** Changed in: python-aiohttp (Ubuntu Focal)
   Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-05-16 Thread Olivier Gayot
Tested on a lxd container configured with 8.8.8.8 as the nameserver and
200ms of network latency added with tc.

-
Before upgrading to version in -proposed:
-
$ dpkg-query --show python3-aiohttp
python3-aiohttp 3.6.2-1build1

$ python3 file.py
Task exception was never retrieved
future:  
exception=gaierror(-2, 'Name or service not known')>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
addrs = await \
  File "/usr/lib/python3/dist-packages/aiohttp/resolver.py", line 29, in resolve
infos = await self._loop.getaddrinfo(
  File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
  File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known


After upgrading to version in -proposed:
-
$ dpkg-query --show python3-aiohttp
python3-aiohttp 3.6.2-1ubuntu1

$ python3 file.py
$ 

Also tested using a subiquity ISO based on the 22.04.1 snap version.
No crash when using the python3-aiohttp from proposed.

** Tags removed: verification-needed-focal
** Tags added: verification-done-focal

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-05-16 Thread Olivier Gayot
** Description changed:

  [Impact]
  
   * When cancelling a connector task, the associated resolver task (if
  not finished) is not cancelled and continues running.
  
  Unfortunately, if the resolver task eventually raises an exception
  (e.g., socket.gaierror), the exception will go directly to the exception
  handler because none will be awaiting the task anymore.
  
  This results in applications crashing with exceptions such as:
  
  Task exception was never retrieved
  future:  
exception=gaierror(-2, 'Name or service not known')>
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
  addrs = await \
    File "/usr/lib/python3/dist-packages/aiohttp/resolver.py", line 29, in 
resolve
  infos = await self._loop.getaddrinfo(
    File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
  return await self.run_in_executor(
    File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  result = self.fn(*self.args, **self.kwargs)
    File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
  for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -2] Name or service not known
  
   * This aiohttp bug is the root cause of a crash in Subiquity: 
https://bugs.launchpad.net/ubuntu-power-systems/+bug/1969393
  Currently, we build the Subiquity snap based on deb packages (including 
python3-aiohttp) from focal. We temporarily moved from python3-aiohttp to 
python3-requests in Subiquity to work around this crash.
   * Other applications based on python3-aiohttp can be affected and crash 
despite the absence of other bug reports.
  
   * The patch in the debdiff makes sure that resolver tasks end up being
  awaited when the associated connector tasks gets cancelled.
  
  [Test Plan]
  
-  * The following chunk of code can be executed to reproduce the issue:
- https://paste.ubuntu.com/p/XrnfqVHtBh/ (it takes ~60 seconds to
- execute).
+  * The following chunk of code can be executed to reproduce the issue: 
https://paste.ubuntu.com/p/XrnfqVHtBh/ (it takes ~60 seconds to execute).
+  * The bug is way easier to reproduce is there is some delay in the DNS 
resolution. One way to simulate some delay is to use a non-local DNS server and 
run:
+ 
+ # tc qdisc add dev eth0 root netem delay 200m
+ 
+ where eth0 is the name of the interface used for DNS resolutions.
+ This can be reverted using:
+ # tc qdisc del dev eth0 root netem
  
  * On python3-aiohttp 3.6 (focal), the exception handler wakes up
  with:
  
  Task exception was never retrieved
  future:  
exception=gaierror(-2, 'Name or service not known')>
  
  * When aiohttp is patched, nothing should happen.
  
   * Manually testing the patched library against Subiquity to make sure it 
solves https://bugs.launchpad.net/ubuntu-power-systems/+bug/1969393.
  This was done on my end using this PPA: 
https://launchpad.net/~ogayot/+archive/ubuntu/focal-bugfix . Tests were green.
  
  [Where problems could occur]
  
   * Since the patch affects a python library, any application that
  depends on this library (aka. python3-aiohttp) on focal would be
  affected by the upload.
  
   * In the unlikely event that this patch introduces a regression,
  applications that depend on python3-aiohttp (i.e., in focal/universe)
  can crash or raise exceptions.
  
   * If any package in focal/main has python3-aiohttp as a Build-Depends,
  a regression could cause said package to FTBFS.
  
  [Other Info]
  
   * The debdiff brings a backport of an upstream patch that is present in
  aiohttp 3.7 and newer versions:
  
  https://github.com/aio-libs/aiohttp/pull/5050
  
   * Upstream bug report: https://github.com/aio-libs/aiohttp/issues/4330

** Description changed:

  [Impact]
  
   * When cancelling a connector task, the associated resolver task (if
  not finished) is not cancelled and continues running.
  
  Unfortunately, if the resolver task eventually raises an exception
  (e.g., socket.gaierror), the exception will go directly to the exception
  handler because none will be awaiting the task anymore.
  
  This results in applications crashing with exceptions such as:
  
  Task exception was never retrieved
  future:  
exception=gaierror(-2, 'Name or service not known')>
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
  addrs = await \
    File "/usr/lib/python3/dist-packages/aiohttp/resolver.py", line 29, in 
resolve
  infos = await self._loop.getaddrinfo(
    File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
  return await self.run_in_executor(
    File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  result = self.fn(*self.args, **self.kwargs)
    File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
  for res in _socket.getaddrinfo(host, 

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-05-10 Thread Brian Murray
Hello Olivier, or anyone else affected,

Accepted python-aiohttp into focal-proposed. The package will build now
and be available at https://launchpad.net/ubuntu/+source/python-
aiohttp/3.6.2-1ubuntu1 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, what testing has been
performed on the package and change the tag from verification-needed-
focal to verification-done-focal. If it does not fix the bug for you,
please add a comment stating that, and change the tag to verification-
failed-focal. In either case, without details of your testing we will
not be able to proceed.

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

N.B. The updated package will be released to -updates after the bug(s)
fixed by this package have been verified and the package has been in
-proposed for a minimum of 7 days.

** Changed in: python-aiohttp (Ubuntu Focal)
   Status: In Progress => Fix Committed

** Tags added: verification-needed verification-needed-focal

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-27 Thread Gunnar Hjalmarsson
Sponsored to focal.

** Changed in: python-aiohttp (Ubuntu)
   Status: Confirmed => Fix Released

** Changed in: python-aiohttp (Ubuntu Focal)
   Status: New => In Progress

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-27 Thread Olivier Gayot
** Description changed:

  [Impact]
  
   * When cancelling a connector task, the associated resolver task (if
  not finished) is not cancelled and continues running.
  
  Unfortunately, if the resolver task eventually raises an exception
  (e.g., socket.gaierror), the exception will go directly to the exception
  handler because none will be awaiting the task anymore.
  
  This results in applications crashing with exceptions such as:
  
  Task exception was never retrieved
  future:  
exception=gaierror(-2, 'Name or service not known')>
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
  addrs = await \
    File "/usr/lib/python3/dist-packages/aiohttp/resolver.py", line 29, in 
resolve
  infos = await self._loop.getaddrinfo(
    File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
  return await self.run_in_executor(
    File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
  result = self.fn(*self.args, **self.kwargs)
    File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
  for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
  socket.gaierror: [Errno -2] Name or service not known
  
   * This aiohttp bug is the root cause of a crash in Subiquity: 
https://bugs.launchpad.net/ubuntu-power-systems/+bug/1969393
  Currently, we build the Subiquity snap based on deb packages (including 
python3-aiohttp) from focal. We temporarily moved from python3-aiohttp to 
python3-requests in Subiquity to work around this crash.
   * Other applications based on python3-aiohttp can be affected and crash 
despite the absence of other bug reports.
  
   * The patch in the debdiff makes sure that resolver tasks end up being
  awaited when the associated connector tasks gets cancelled.
  
  [Test Plan]
  
   * The following chunk of code can be executed to reproduce the issue:
  https://paste.ubuntu.com/p/XrnfqVHtBh/ (it takes ~60 seconds to
  execute).
  
  * On python3-aiohttp 3.6 (focal), the exception handler wakes up
  with:
  
  Task exception was never retrieved
  future:  
exception=gaierror(-2, 'Name or service not known')>
  
- * When aiohttp is patched, nothing should happens.
+ * When aiohttp is patched, nothing should happen.
  
   * Manually testing the patched library against Subiquity to make sure it 
solves https://bugs.launchpad.net/ubuntu-power-systems/+bug/1969393.
  This was done on my end using this PPA: 
https://launchpad.net/~ogayot/+archive/ubuntu/focal-bugfix . Tests were green.
  
  [Where problems could occur]
  
   * Since the patch affects a python library, any application that
  depends on this library (aka. python3-aiohttp) on focal would be
  affected by the upload.
  
   * In the unlikely event that this patch introduces a regression,
  applications that depend on python3-aiohttp (i.e., in focal/universe)
  can crash or raise exceptions.
  
   * If any package in focal/main has python3-aiohttp as a Build-Depends,
  a regression could cause said package to FTBFS.
  
  [Other Info]
  
   * The debdiff brings a backport of an upstream patch that is present in
  aiohttp 3.7 and newer versions:
  
  https://github.com/aio-libs/aiohttp/pull/5050
  
-  * Upstream bug report: https://github.com/aio-libs/aiohttp/issues/4330
+  * Upstream bug report: https://github.com/aio-libs/aiohttp/issues/4330

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-27 Thread Łukasz Zemczak
** Also affects: python-aiohttp (Ubuntu Focal)
   Importance: Undecided
   Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-25 Thread Olivier Gayot
** Tags added: fr-2268

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-22 Thread Olivier Gayot
** Changed in: python-aiohttp (Ubuntu)
   Status: New => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-22 Thread Olivier Gayot
** Description changed:

- Occurs in the version 3.6 of aiohttp (present currently in focal).
  
- When cancelling a connector task, the associated resolver task (if not
- finished) is not cancelled and continues running.
+ [Impact] 
+ 
+  * When cancelling a connector task, the associated resolver task (if
+ not finished) is not cancelled and continues running.
  
  Unfortunately, if the resolver task eventually raises an exception
  (e.g., socket.gaierror), the exception will go directly to the exception
  handler because none will be awaiting the task anymore.
  
- This is the root cause of https://bugs.launchpad.net/ubuntu-power-
- systems/+bug/1969393
+ This results in applications crashing with exceptions such as:
  
- The fix on aiohttp was backported to 3.7 but not to 3.6.
+ Task exception was never retrieved
+ future:  
exception=gaierror(-2, 'Name or service not known')>
+ Traceback (most recent call last):
+   File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
+ addrs = await \
+   File "/usr/lib/python3/dist-packages/aiohttp/resolver.py", line 29, in 
resolve
+ infos = await self._loop.getaddrinfo(
+   File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
+ return await self.run_in_executor(
+   File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
+ result = self.fn(*self.args, **self.kwargs)
+   File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
+ for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
+ socket.gaierror: [Errno -2] Name or service not known
+ 
+  * This aiohttp bug is the root cause of a crash in Subiquity: 
https://bugs.launchpad.net/ubuntu-power-systems/+bug/1969393
+ Currently, we build the Subiquity snap based on deb packages (including 
python3-aiohttp) from focal. We temporarily moved from python3-aiohttp to 
python3-requests in Subiquity to work around this crash.
+  * Other applications based on python3-aiohttp can be affected and crash 
despite the absence of other bug reports.
+ 
+  * The patch in the debdiff makes sure that resolver tasks end up being
+ awaited when the associated connector tasks gets cancelled.
+ 
+ [Test Plan]
+ 
+  * The following chunk of code can be executed to reproduce the issue: 
https://paste.ubuntu.com/p/XrnfqVHtBh/ (it takes ~60 seconds to execute).
+  
+ * On python3-aiohttp 3.6 (focal), the exception handler wakes up with:
+ 
+ Task exception was never retrieved
+ future:  
exception=gaierror(-2, 'Name or service not known')>
+
+ * When aiohttp is patched, nothing should happens.
+ 
+  * Manually testing the patched library against Subiquity to make sure it 
solves https://bugs.launchpad.net/ubuntu-power-systems/+bug/1969393.
+ This was done on my end using this PPA: 
https://launchpad.net/~ogayot/+archive/ubuntu/focal-bugfix . Tests were green.
+ 
+ [Where problems could occur]
+ 
+  * Since the patch affects a python library, any application that
+ depends on this library (aka. python3-aiohttp) on focal would be
+ affected by the upload.
+ 
+  * In the unlikely event that this patch introduces a regression,
+ applications that depend on python3-aiohttp (i.e., in focal/universe)
+ can crash or raise exceptions.
+ 
+  * If any package in focal/main has python3-aiohttp as a Build-Depends, a 
regression could cause said package to FTBFS.
+  
+ [Other Info]
+  
+  * The debdiff brings a backport of an upstream patch that is present in 
aiohttp 3.7 and newer versions:
  
  https://github.com/aio-libs/aiohttp/pull/5050

** Description changed:

+ [Impact]
  
- [Impact] 
- 
-  * When cancelling a connector task, the associated resolver task (if
+  * When cancelling a connector task, the associated resolver task (if
  not finished) is not cancelled and continues running.
  
  Unfortunately, if the resolver task eventually raises an exception
  (e.g., socket.gaierror), the exception will go directly to the exception
  handler because none will be awaiting the task anymore.
  
  This results in applications crashing with exceptions such as:
  
  Task exception was never retrieved
  future:  
exception=gaierror(-2, 'Name or service not known')>
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
- addrs = await \
-   File "/usr/lib/python3/dist-packages/aiohttp/resolver.py", line 29, in 
resolve
- infos = await self._loop.getaddrinfo(
-   File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
- return await self.run_in_executor(
-   File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
- result = self.fn(*self.args, **self.kwargs)
-   File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
- for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
+   File "/usr/lib/python3/dist-packages/aiohttp/connector.py", line 829, in 
_resolve_host
+ addrs = 

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-22 Thread Olivier Gayot
** Changed in: python-aiohttp (Ubuntu)
   Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

[Bug 1969817] Re: Uncaught exception when connector is cancelled

2022-04-22 Thread Olivier Gayot
Adding debdiff

** Patch added: "1-3.6.2-1build1-3.6.2-1ubuntu1.debdiff"
   
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+attachment/5582552/+files/1-3.6.2-1build1-3.6.2-1ubuntu1.debdiff

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1969817

Title:
  Uncaught exception when connector is cancelled

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-aiohttp/+bug/1969817/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs