Cancelling HTTP calls from client side cause server side failure

Bug #1968729 reported by Olivier Gayot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
subiquity
New
Undecided
Unassigned

Bug Description

It seems that cancelling HTTP calls from the client side of Subiquity end-up causing failures on the server side. It is easy to reproduce for the drivers controller but other components (such as storage, snaplist, ...) are also affected.

Context: this happened to me in the storage controller when implementing cancellation of probing tasks in the end_ui() method.

HTTP calls are automatically cancelled on the client side when an asyncio.CancelledError is raised. This can happen for various reasons.

One way to test how the server responds to such events is to use curl and send it a SIGINT (ctrl-c).

The issue can be reproduced in dry-run mode:

$ make dry-run
$ curl --unix-socket .subiquity/socket 'http://a/drivers?wait=true'
^C

$ tail .subiquity/subiquity-server-debug.log
[...]
2022-04-12 12:59:21,268 DEBUG root:39 finish: subiquity/Refresh/check_for_update: SUCCESS: new version of snap available: '19.07.2'
2022-04-12 12:59:22,597 ERROR root:39 finish: subiquity/Drivers/_list_drivers/wait_apt: FAIL: cancelled
2022-04-12 12:59:22,597 ERROR root:39 finish: subiquity/Drivers/_list_drivers: FAIL: cancelled
2022-04-12 12:59:22,597 ERROR root:39 finish: subiquity/Drivers/GET: FAIL: cancelled

$ curl --unix-socket .subiquity/socket 'http://a/drivers?wait=true'
curl: (52) Empty reply from server

$ tail .subiquity/subiquity-server-debug.log
2022-04-12 12:59:22,597 ERROR root:39 finish: subiquity/Drivers/_list_drivers: FAIL: cancelled
2022-04-12 12:59:22,597 ERROR root:39 finish: subiquity/Drivers/GET: FAIL: cancelled
2022-04-12 13:01:29,533 DEBUG root:39 start: subiquity/Drivers/GET:
2022-04-12 13:01:29,533 ERROR root:39 finish: subiquity/Drivers/GET: FAIL: cancelled

The consequences vary from one controller to another, but in most cases it results in a crash in the installer or the GUI showing the progress screen indefinitely.

Tags: fr-2253
Revision history for this message
Olivier Gayot (ogayot) wrote :

Upon closing a HTTP socket / cancelling a task on the client side, the server side reacts by raising a asyncio.CancelledError exception.

This behavior could be intentional or not.

I haven't yet figured out if the exception is raised by Subiquity itself, by aiohttp or by something else.

description: updated
Revision history for this message
Olivier Gayot (ogayot) wrote :

After testing, it seems that aiohttp is the one raising CancelledError exceptions when connections are closed by the client.

Olivier Gayot (ogayot)
tags: added: fr-2253
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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