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: Sun, 26 Dec 2021 14:55:20 +0200

> Date: Sun, 26 Dec 2021 13:48:36 +0200
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org
> 
> > >   Test multi-test-files-simple condition:
> > >       (ert-test-failed
> > >        ((should
> > >    (=
> > >     (multisession-value multisession--sfoo)
> > >     2))
> > >   :form
> > >   (= 1 2)
> > >   :value nil))
> > >
> > > So I think the problem I'm seeing here is not that Emacs cannot access
> > > the file, it's something else.  Any ideas for digging into this?
> > 
> > If you could get the test to cough up what's in the multisession
> > directory when this happens, that would be helpful.
> 
> I will try.

I think I understand what happens here.  It's a race condition (of
course!).

This code from multisession-backend-value:

     ;; We have a value, but we want to update in case some other
     ;; Emacs instance has updated.
     ((multisession--synchronized object)
      (if (and (file-exists-p file)
               (time-less-p (multisession--cached-sequence object)
                            (file-attribute-modification-time
                             (file-attributes file))))
          (multisession--read-file-value file object)
        ;; Nothing, return the cached value.
        (multisession--cached-value object)))

assumes that the file always exists.  But on Windows, it sometimes
doesn't.

What I see is that if multisession-tests.el looks at the contents of
the value file, it sees the updated value, even though the test fails
because its value is before the update.  Which means the Emacs session
running the test didn't read the file at all.

And note that multisession--read-file-value already tests for the
file's existence, and retries if it doesn't exist.

So I think we should simply restructure the code, and let
multisession--read-file-value do the test and the waiting, and
multisession-backend-value should just return the cached value if
multisession--read-file-value failed to read the file.



reply via email to

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