zsh-workers
 help / color / mirror / code / Atom feed
From: Philippe Troin <phil@fifi.org>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Issues with fcntl() history file locking
Date: Fri, 08 Mar 2019 16:53:08 -0800	[thread overview]
Message-ID: <70520d027e2f5ddc09b2c78d543664b52341f450.camel@fifi.org> (raw)
In-Reply-To: <a060cc4cac0f540e66585f4137294aa9d7ab2ab9.camel@fifi.org>

On Wed, 2019-02-27 at 22:36 -0800, Philippe Troin wrote:
> On Wed, 2019-02-27 at 13:27 -0800, Bart Schaefer wrote:
> > On Wed, Feb 27, 2019 at 10:31 AM Philippe Troin <phil@fifi.org>
> > wrote:
> > > 
> > > The right and hard way is to have the various calls to open() the
> > > history file to actually use the flock_fd lock file descriptor
> > > (and not close it when done with it, leaving that to
> > > unlockhistfile()).
> > > 
> > > The easy messy way is to keep track of all the open descriptors
> > > to the history file in a global variable, and delaying the actual
> > > close until unlockhistfile() is called.
> > 
> > If this actually turns out to be necessary, the second way is more
> > similar to how we handle descriptors in other parts of the shell.
> 
> I'll do further experiments.
> 
> This is my current hunch:  everything is swell as long as lines are
> appended to the history file.  But, when one host decides it's time
> to
> trim the history file is when stuff hits the fan.  If someone had an
> idea on how to force zsh to trim history reliably, I'm all ears.

So, I've implemented what I described (delaying closing the file
descriptors and handles until unlock time).
The rough patches will follow shortly.

But, it doesn't help the problem at all:  I've been running 5.7.1 +
that patch on a small network, and I ran into the same issue again :-/
Back to the drawing board...
It's something else that's happening.

I'll let you decide if the patches are worth inclusion or not.
Since it doesn't fix any actual issues, probably not, even though this
is supposed to be more correct to avoid history corruption on network
filesystems when hist_fcntl_lock is active.

Phil.


  reply	other threads:[~2019-03-09  0:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 18:30 Philippe Troin
2019-02-27 21:27 ` Bart Schaefer
2019-02-28  6:36   ` Philippe Troin
2019-03-09  0:53     ` Philippe Troin [this message]
2019-03-09  0:54       ` [PATCH 1/3] Move readhistfile() after flockhistfile() Philippe Troin
2019-03-09  0:54         ` [PATCH 2/3] Factorize the code that unlock the fcntl() lock into funlockhistfile() Philippe Troin
2019-03-09  0:54         ` [PATCH 3/3] Delay closing the history file until the fcntl-lock is released Philippe Troin
     [not found]         ` <CAH+w=7aUD11M_GYy-FOC5MPGpGXb+o9O_q855OTC32fnSnpshQ@mail.gmail.com>
     [not found]           ` <82f4a6db638fbfce396e64a45029424185863068.camel@fifi.org>
     [not found]             ` <CAH+w=7ZS=ke8xHuBaO+hu0-RTtW=GYnG-0MENfBtTsyyp9joyg@mail.gmail.com>
     [not found]               ` <3228a3e68f2580fc25a9fda9bf7ccf5ce9a73689.camel@fifi.org>
2019-03-10  1:19                 ` [PATCH 1/3] Move readhistfile() after flockhistfile() Bart Schaefer
2019-03-11 21:04                   ` Jason L Tibbitts III
2019-03-12  7:55                     ` Jun T
2019-03-12  9:52                       ` Peter Stephenson

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=70520d027e2f5ddc09b2c78d543664b52341f450.camel@fifi.org \
    --to=phil@fifi.org \
    --cc=zsh-workers@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).