snapd
snapd copied to clipboard
cmd/snap: run inhibition flow in goroutine
This avoids the deadlock scenario:
- snap run holds inhibition lock.
- snapd holds state lock (link-snap).
- snapd tries to hold inhibition lock but waits for snap run to release lock.
- snap run calls the REST API (i.e. for notices, connections) which tries to hold state lock.
- snap run is now waiting for snapd to release state lock (to send the notice) and snapd is waiting for snap run to release the inibition lock.
- we have a deadlock and snapd state is locked.
Running inhibition flow in a goroutine allows snap run to release the inhibition lock.
Fixes: https://bugs.launchpad.net/snapd/+bug/2084730
@bboozzoo @pedronis @ZeyadYasser should we close this PR and focus on the state unlocker PR?
Blocked by decision.
This is not important for 2.67, We decided to remove this from 2.67 and rather release as .x or 2.68.