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
high max-errors causes prolonged max-cpu consumption #946
Comments
I agree, the errors should definitely be capped. Most commands shouldn't have more than 10 errors anyways. For me, something like zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3>7?7:($#PREFIX+$#SUFFIX)/3))numeric)' capped it at 7. |
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
@el1t That works much better; I took the liberty of submitting a PR with your change. |
@catharsis cool glad I could help! |
Can you show me an example of when you got high CPU usage? I'd like to test it myself. |
@sorin-ionescu As described in the original report; Simply doing Of course, the same effect is seen for any path completions that aren't close to anything that exists in the file system. |
Don't type so many a then. Give me a real usage scenario. I'm asking because I have had no trouble with the current maximum errors. |
Ok, I see what you're saying, my mistake. Well, consider for example the case where you're the kind of person who copies instructions from the internet when you're trying to fix a problem. The instructions say you should edit Or, perhaps you have a temporary device or file system at |
Here's another example that I just ran into: I had a git commit that I needed to cherry-pick from a branch in my clipboard. I started typing: |
@sorin-ionescu Do you agree that this is a valid issue? Is there anything blocking #953 from getting merged? |
It is a valid issue. Nothing is blocking merging it. I will merge it. |
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes #946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
7 is pretty arbitrarily chosen, but seems like a reasonable tradeoff, at least the completion no longer shows symptoms of exponential time-growth when trying to complete something completely wrong. This fixes sorin-ionescu#946.
So, I don't know if the solution here is "so don't do that", but I figured it might be worth bringing it up;
https://github.com/sorin-ionescu/prezto/blob/master/modules/completion/init.zsh#L70 sets max-errors to the length of PREFIX+SUFFIX/3. Now I'm completely new to this, but on my system, this means that doing something like
when no file with a similar name exists in the current directory causes zsh to hang and peak on CPU% for a long time. The time needed to complete seems to grow close-to-exponentially. I know this example is pretty contrived but I think it demonstrates the issue well enough.
So, my query is: is there a better, perhaps more conservative way to set max-errors to avoid this hanging? It seems to me that deciding on a ceiling for max-errors, based on some clever heuristics might be worthwhile.
The text was updated successfully, but these errors were encountered: