emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sqlite3


From: Eli Zaretskii
Subject: Re: sqlite3
Date: Fri, 17 Dec 2021 10:07:53 +0200

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Fri, 17 Dec 2021 08:38:44 +0100
> 
> >>     (file-error "Opening input file" "Permission denied"
> >> "c:/Users/larsi/AppData/Local/Temp/emacs-test-nJO8TU-multisession/files/sbar/sbar.value")
> >
> > Is this code on master?  If so, can you show some recipe to reproduce
> > this?
> 
> It's the multi-test-files-simple code in multisession-tests.el (but you
> have to revert ed77d1a8c0 to see it).
> 
> >> There's probably something about file locking on Windows that I don't
> >> understand.
> >
> > Who does the file locking in this case, and by what means?
> 
> That's what I don't know.
> 
> What I think the code does is this:
> 
> 1) First Emacs 1 writes the file.
> 2) Then I start another Emacs, and it also writes the file, and then that
> Emacs exits.
> 3) Then Emacs 1 wants to read the file, and it fails with that error.
> 
> If Emacs 1 waits a bit, then it's apparently allowed to open that file,
> but I'm not quite sure about that.

If Emacs 1 attempts to open and read the file while Emacs 2 still
writes to it, Windows will not let Emacs 1 open the file, and the
failure will be EACCES, as your report shows.  That's because the
default way of opening files which we use in Emacs opens them in
"unshared" mode, so they cannot be shared between different processes.

Which probably means multisession.el should have some mechanism to
deal with this gracefully, like retrying the open/read several times
before giving up.  After all, the window for such races should be
quite short, given that we write very small files.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]