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

sometime, oh-my-zsh Taking too much time while login #7422

Closed
johnzeng opened this Issue Nov 20, 2018 · 7 comments

Comments

Projects
None yet
4 participants
@johnzeng
Copy link

johnzeng commented Nov 20, 2018

This happens quit randomly, and it won't happen for a while after a trigger. So any idea that I can save login log into a file, so I can check it out when the issue happen ?

@respencer

This comment has been minimized.

Copy link

respencer commented Feb 4, 2019

Do you have automatic updates running in the background for oh-my-zsh?

@johnzeng

This comment has been minimized.

Copy link
Author

johnzeng commented Feb 5, 2019

@respencer I checked about it before, auto update is disabled

@respencer

This comment has been minimized.

Copy link

respencer commented Feb 6, 2019

Then I suspect something else is eating up resources in the background.

Unfortunately without having a system monitor running all the time and catching it in the act, it may be hard to pin down.

I don't know what system you are using, as reference on mine first thing in the morning my automated updates spikes system load. In addition Firefox and Thunderbird regularly screws me over if I leave them running longer than a day.

@johnzeng

This comment has been minimized.

Copy link
Author

johnzeng commented Feb 6, 2019

I use oh my zsh on Mac item 2. I think problem happens on iterm 2 or zsh, but I don’t know where to find the problem

@mcornella

This comment has been minimized.

Copy link
Collaborator

mcornella commented Feb 6, 2019

You can use the zprof module to profile your zsh startup, like this:

# zshrc

zmodload zsh/zprof
# beginning of code to be profiled
...
...
# end of code to be profiled
zprof
zmodload -u zsh/zprof

The call to zprof is what prints out the stats of time spent. You can redirect it to a file of your choosing, that way you can read the profiling only when the startup was slow.

@xrubioj

This comment has been minimized.

Copy link

xrubioj commented Feb 12, 2019

Thanks @mcornella! Your tip #7422 (comment) helped to diagnose my slow startup time of new shells. In my case, it was because of NVM.

If it can be of any help, see creationix/nvm#1978 My current workaround is adding --no-use to NVM init script and calling nvm use default manually later if I need to use npm.

[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" --no-use # This loads nvm

@mcornella mcornella added the question label Feb 12, 2019

@mcornella

This comment has been minimized.

Copy link
Collaborator

mcornella commented Feb 12, 2019

Cool, glad to be of service!

@mcornella mcornella closed this Feb 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment