Fix races by implementing our own incus client fork - #132
Merged
Conversation
The upstream client shares state between a connection, its event listeners and the operations running on it, so one InstanceServer cannot be driven from several goroutines. A second GetEvents joins the first caller's listener and inherits its type filter, so an operation waiting on a type=operation event never sees it; skipEvents races on top. iclient holds nothing mutable, gives every listener a socket of its own, takes a context per call and reports operations as channels. Nothing uses it yet. Signed-off-by: René Jochum <rene@jochum.dev>
Every worker drove one shared Incus client, whose event-listener state cannot be used from more than one goroutine. They now share an iclient.Connection, which is safe to share, and the per-resource connection copies that worked around it are gone. The races that sat on top of it go with it: two workers setting up the image lock volume at once, simultaneous starts resolving which ic-healthd watches the project, and a wait for an instance's addresses that trusted a lifecycle event. A registry is now somewhere the server is pointed at rather than something we dial, so --pull always re-downloads instead of comparing digests. A busy instance is matched on a sentinel, not on the wording of the error, and the retry that waits for a cached image respects its context and the five minutes it claims. Signed-off-by: René Jochum <rene@jochum.dev>
It picked the newest log with `ls -t | head -1`, which leaves ls writing into a closed pipe; under pipefail that SIGPIPE failed the recipe before it printed anything. The no-pattern branch had the same problem one level up, so `just test-log | head` failed too. Also runs the tests with -race and checks formatting in lint. Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
Signed-off-by: René Jochum <rene@jochum.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.