Skip to content

Conversation

@tomponline
Copy link
Member

@tomponline tomponline commented Jun 7, 2025

This is to avoid a potential race where the go routine takes the mutex and tries to send the acquired message to the outer function before it is waiting on the channel and then incorrectly detects this as the outer function having returned, which then results in the outer function waiting until the 20s timeout and returning an error.

Fixes issue introduced by #15726

This is to avoid a potential race where the go routine takes the mutex and tries
to send the acquired message to the outer function before it is waiting on the channel
and then incorrectly detects this as the outer function having returned, which then
results in the outer function waiting until the 20s timeout and returning an error.

Signed-off-by: Thomas Parrott <[email protected]>
@tomponline tomponline changed the title lxd/db/db: Rework RunExclusive to use context with timeout internally lxd/db: Rework RunExclusive to use context with timeout internally Jun 7, 2025
@tomponline tomponline self-assigned this Jun 7, 2025
@tomponline tomponline requested a review from simondeziel June 7, 2025 21:12
@simondeziel
Copy link
Member

You probably know but just in case, the main branch also ran into this during unit tests: https://github.com/canonical/lxd/actions/runs/15513043189/job/43676314476#step:24:738

@tomponline tomponline merged commit dd2cac9 into canonical:main Jun 8, 2025
30 checks passed
@tomponline tomponline deleted the tp-exclusive branch June 9, 2025 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants