From: Piotr Karbowski <piotr.karbowski@protonmail.ch>
To: zsh-users@zsh.org
Subject: The HIST_EXPIRE_DUPS_FIRST might corrupt and wipe partially history file if many shells exit at the same time
Date: Sun, 19 Mar 2023 11:56:26 +0000 [thread overview]
Message-ID: <33a75d10-d765-3d79-a179-943c57659111@protonmail.ch> (raw)
Hi,
Recently I went ahead and enabled HIST_EXPIRE_DUPS_FIRST on my systems
in order to get the most out of zsh_history. It worked great however I
on two separated ocasions had a large chunk of my history file being
lost. I narrowed it down to HIST_EXPIRE_DUPS_FIRST
They way I can reproduce it sometimes is if multiple zsh shells exit at
the very same time. It happens when I terminate tmux session that have
10+ zsh instances,or when I just reboot my system while I have dozens of
urxvt instances open. This leads to all of the zsh instances to exit and
do it's magic. This however happens only if I intentionally litter my
.zsh_history to make the zsh actually want to run this logic. meaning
the steps to reproduce would be:
- Exit multiple zsh instances at the very same time.
- Have .zsh_history big enough (HISTSIZE, SAVEHIST) so it trigger this
logic.
I had it happen to me (outside of trying to reproduce it) twice, on one
system as root, on another as non-root user.
Before I reported it I checked all the other things that could lead to
this corruption, and I found a single user reporting the very same
problem year and half ago on stackoverflow[1], he does indeed have
histexpiredupsfirst enabled.
The relevant configuration change that I did to enable this (among few
other)
HISTSIZE='128000'
-SAVEHIST='128000'
+SAVEHIST='96000'
+setopt hist_expire_dups_first
setopt hist_ignore_dups
+setopt hist_ignore_all_dups
+setopt hist_find_no_dups
+setopt hist_save_no_dups
I have disabled this feature since due those corruptions. Would love to
get back to it though, perhaps adding some locking mechanism would help
here?
[1]
https://stackoverflow.com/questions/69434630/closing-multiple-iterm2-tabs-makes-zsh-history-lose-most-of-the-history
-- Piotr.
next reply other threads:[~2023-03-19 11:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 11:56 Piotr Karbowski [this message]
2023-03-19 16:53 ` Bart Schaefer
2023-03-19 18:38 ` Piotr Karbowski
2023-03-19 21:01 ` Bart Schaefer
2023-03-19 21:17 ` Piotr Karbowski
2023-03-19 21:34 ` Bart Schaefer
2023-03-19 21:53 ` Piotr Karbowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33a75d10-d765-3d79-a179-943c57659111@protonmail.ch \
--to=piotr.karbowski@protonmail.ch \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).