-
Notifications
You must be signed in to change notification settings - Fork 2.1k
revert "improve plugins discovery performance" #4147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This reverts commit 62f2358. Spawning a goroutine for each iteration in the loop when listing plugins is racy unfortunately. `plugins` slice is protected with a mutex so not sure why it fails. I tried using a channel to collect the plugins instead of a slice to guarantee that they will be appended to the list in the order they are processed but no dice. I also tried without errgroup package and simply use sync.WaitGroup but same. I have also created an extra channel to receive errors from the goroutines but racy too. I think the change in this function is not related to the race condition but newPlugin is. So revert in the meantime :( Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
|
Performance improvements from #4129 do not have an impact with this commit. See updated bench result: https://github.com/crazy-max/docker-cli-bench/blob/c53a2c6eb9216af09034205d156c78c222f2db73/bench.md |
|
Looks like its racing because Wrote a test case for this (sort of...) and it looks like its racing because func (c *Command) Commands() []*Command {
// do not sort commands if it already sorted or sorting was disabled
if EnableCommandSorting && !c.commandsAreSorted {
sort.Sort(commandSorterByName(c.commands))
c.commandsAreSorted = true
}
return c.commands
} |
Thanks @cpuguy83 I was just saying that to @thaJeztah on Slack earlier, should have put that in the PR description 🙈
I will take another look thx |
|
@crazy-max do @cpuguy83 you want to include changes in this PR, or as a follow-up? I'm considering doing a new build of 24.0.0-beta.1 , and we could consider merging this PR (revert of that commit), then work on the alternative |
thaJeztah
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (if we're okay with doing this as first step)
|
I'm fine for a follow-up 👍 |
fixes #4145
related to #4142 (comment)
- What I did
Spawning a goroutine for each iteration in the loop when listing plugins is racy unfortunately.
pluginsslice is protected with a mutex so not sure why it fails.I tried using a channel to collect the plugins instead of a slice to guarantee that they will be appended to the list in the order they are processed but no dice.
I also tried without
errgrouppackage and simply usesync.WaitGroupbut same. I have also created an extra channel to receive errors from the goroutines but racy too.I think the change in this function is not related to the race condition but
newPluginfunc is.- How I did it
Reverts commit 62f2358.
- How to verify it
Run repro from #4145
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)