2

from time to time changing to a directory (through terminal) launches git process which takes 100% of CPU time and up to 5-6 seconds during which my console is absolutely unresponsive.

This doesn't happen every time when I navigate to this directory, but it happens several times during the day.

After 5-7 seconds git process is gone and I get into the directory

Any ideas?

my ~.zshrc is here

➜  Config git:(develop) uname -a         
Linux dmitry 4.13.4-200.fc26.x86_64 #1 SMP Thu Sep 28 20:46:39 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
➜  Config git:(develop) zsh --version    
zsh 5.3.1 (x86_64-redhat-linux-gnu)
➜  Config git:(develop) 
➜  Config git:(develop) bash --version
GNU bash, version 4.4.12(1)-release (x86_64-redhat-linux-gnu)
  • 3
    Your zsh/git configurations are going to be critical to diagnosing this. – Jeff Schaller Oct 9 '17 at 23:19
  • 1
    Are you using some git command to set (parts of) your shell prompt? – NickD Oct 10 '17 at 0:01
  • 1
    I have added .zshrc config. I'm using antigen to load modules and display status info in the prompt. It gets some info from git, but I have no custom invocation of git by my own code. It just started to happen last week and infrequently. Like 2-3 times a day. – DmitrySemenov Oct 10 '17 at 0:13
  • Is this directory on a local disk or some network share? – Andy Dalton Oct 10 '17 at 3:38
  • Local, ssd disks @AndyDalton – DmitrySemenov Oct 10 '17 at 5:38
1

You'll probably have to debug it yourself as your ~/.zshrc is very specific and uses many third party extensions.

Some debugging tools that will help you here:

  • PS4='+[%D{%T.%.}] %N:%i> ' zsh -x

    and try to reproduce the problem.

    That will log all commands run by zsh with some timing so you can identify which one takes a lot of time and what is calling it.

    You may want to run that under script (see also its -t option) or with 2> file.log as the output is likely to be very copious.

  • strace -tte execve -s 999 -o strace.log zsh

    That traces all command executions again with timing.

You could also instrument calls to git only with something like:

git() {
  local PS4='[%D{%T.%.}] %N:%i:'
  print -u2 -f '-> %s (%s)\n' ${funcstack:^funcfiletrace}
  set -o localoptions -o xtrace
  command git "$@"
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.