Race condition in snaplist causing list of snaps to be (partially) empty
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
subiquity (Ubuntu) |
Fix Released
|
Medium
|
Olivier Gayot |
Bug Description
Because of a race condition, it is possible that the screen supposed to show the list of snaps shows an empty list of snaps (or partially empty).
The race condition is triggered when a network changed event (i.e., SNAPD_NETWORK_
The code vulnerable to the race condition is in this function from subiquity/
```
async def GET(self, wait: bool = False) -> SnapListResponse:
if self.loader.failed or not self.app.
await self.configured()
return SnapListRespons
if not self.loader.
return SnapListRespons
await self.loader.
if self.loader.failed or not self.app.
await self.configured()
return SnapListRespons
return SnapListResponse(
```
And more specifically between the two following instructions:
```
await self.loader.
if self.loader.failed or not self.app.
```
When a SNAPD_NETWORK_
* the task that was returned by self.loader.
* a new loader is created and replaces the old one: `self.loader = self._make_
Therefore, upon reaching the following instruction
```
if self.loader.failed or not self.app.
```
, self.loader is now a new instance of SnapdSnapInfoLo
The first thing that comes to mind to fix this issue would be to do something like:
```
loader = self.loader
await loader.
if loader.failed or not self.app.
```
but ideally, we would not consider this event an error and we would wait for the task of the new loader to finish.
Changed in subiquity (Ubuntu): | |
importance: | Undecided → Medium |
Changed in subiquity (Ubuntu): | |
status: | In Progress → Fix Committed |
https:/ /github. com/canonical/ subiquity/ pull/1426