Page MenuHomeVyOS Platform

REST API configure operation should not be defined as async
Closed, ResolvedPublicBUG

Description

In fixing the errors in retrieve operations in T5006, async was unnecessarily added to configure operations as well; this introduces a bug when a configure operation wants to itself make a call to the http-api. Though not common, perhaps, this is reasonable and supported, except for the bug introduced by overreach in addressing T5006.

The details: the web framework being used, FastAPI/Starlette handles non-async vs async functions by adding the former to a thread pool, which is itself awaited for execution; functions defined as async are run within an event-loop. For non-native async functions, defining them as async will introduce blocking within the event-loop: this is appropriate for retrieve operations that have no internal locking; undesirable for configure operations which do have locking and should not block.

Details

Difficulty level
Easy (less than an hour)
Version
vyos-1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

jestabro changed the task status from Open to In progress.Jun 20 2023, 5:34 PM
jestabro triaged this task as Normal priority.
jestabro created this task.
jestabro created this object in space S1 VyOS Public.
jestabro moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.

VyOS 1.3.3 Still have such an issue. Any plan to fix it on VyOS 1.3?

jestabro reopened this task as Backport pending.Jul 12 2023, 1:05 PM

Yes; it was not evident in 1.3.x until the upgrade of the FastAPI framework for
https://vyos.dev/T5176
and will be backported.