Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: delay in exitting from zsh shell

On Nov 10, 12:20am, Eugene Dzhurinsky wrote:
} Hello, I'm facing the strange issue - when I run zsh shell and eventually try
} to exit from it - it takes some time (3-5 seconds) between I hit Ctrl+D or
} type "exit" in shell prompt.
} After some experiments I realized that if I remove .histfile - then
} ZSH exists immediately, as supposed.

This tends to imply that what's taking those 3-5 seconds is searching
your history file for duplicate entries in order to enforce the
hist_save_no_dups option.  Also, inc_append_history may allow the file
to grow to up to 10500 lines for a SAVEHIST of 10000, and those extra
lines will be trimmed at shell exit.

In more detail, when you use inc_append_history and/or share_history
along with hist_save_no_dups, zsh re-reads and de-duplicates the entire
file from disk after it has obtained a lock for it, rather than just
dumping out the history that is already in memory, because it can't
know if some other shell has appended something new to the file before
the lock was obtained.  The speed of the disk is inconsequential to the
CPU expended doing the deduplication.

Messages sorted by: Reverse Date, Date, Thread, Author