On Wed, Aug 19, 2020 at 10:09:36PM +0200, Kornel Benko wrote: > commit 4bb00e99fbc4e23075088dfdd8e3d566fbd9d187 > Author: Kornel Benko <kor...@lyx.org> > Date: Wed Aug 19 22:28:50 2020 +0200 > > Cmake export tests: Omit next group of possible conflicts while runnig > test in parallel > > Disable conversion cache because all lyx instances use the same cache > without > any locking between read and write to the cache. > > Thanks to Scott catching this case. > ---
Thanks, Kornel. I tried to lock the cache index when writing (patch attached), but that's just the index file. I suppose we would need to lock each cache file created. I can give that an attempt if someone can take a look at the attached patch for the index and let me know if it seems like the correct approach and I can try it for the cache files themselves. Before working on that, I would like to ask if it's desirable to have that in the core code. I don't have a feeling for whether a user is likely to be bitten by this. In theory, it seems that a user could be bitten by this issue if they just open/export the same .lyx file in more than one process. I'm not sure why they would do that though (perhaps by mistake?). Also, conditional upon being bitten by the issue, I'm not sure if it is that bad. I guess it could be viewed as bad if a user does not realize (i.e., no compilation error) if a file in the cache is corrupt, but I would guess that a corrupt file would lead to a compilation error more often than not. Thoughts? Scott
From c4cf7ab36f50038e847bfc2a98e4e4e2adc793b9 Mon Sep 17 00:00:00 2001 From: Scott Kostyshak <skost...@lyx.org> Date: Tue, 18 Aug 2020 21:05:17 -0400 Subject: [PATCH] Lock index --- src/ConverterCache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ConverterCache.cpp b/src/ConverterCache.cpp index c601c3f708..3897d5b7c4 100644 --- a/src/ConverterCache.cpp +++ b/src/ConverterCache.cpp @@ -173,7 +173,9 @@ void ConverterCache::Impl::readIndex() void ConverterCache::Impl::writeIndex() { FileName const index(addName(cache_dir.absFileName(), "index")); - ofstream os(index.toFilesystemEncoding().c_str()); + int fd = fileLock(index.toFilesystemEncoding().c_str()); + + ofstream os(index.toFilesystemEncoding().c_str()); os.close(); if (!index.changePermission(0600)) return; @@ -191,6 +193,7 @@ void ConverterCache::Impl::writeIndex() << it2->second.checksum << '\n'; } os.close(); + fileUnlock(fd, index.toFilesystemEncoding().c_str()); } -- 2.20.1
signature.asc
Description: PGP signature
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel