diff options
-rw-r--r-- | docs/changelog/1938.bugfix.rst | 1 | ||||
-rw-r--r-- | src/virtualenv/app_data/via_disk_folder.py | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/docs/changelog/1938.bugfix.rst b/docs/changelog/1938.bugfix.rst new file mode 100644 index 0000000..0521c84 --- /dev/null +++ b/docs/changelog/1938.bugfix.rst @@ -0,0 +1 @@ +Fix a bug that reading and writing on the same file may cause race on multiple processes. diff --git a/src/virtualenv/app_data/via_disk_folder.py b/src/virtualenv/app_data/via_disk_folder.py index 4b2cadf..55497e8 100644 --- a/src/virtualenv/app_data/via_disk_folder.py +++ b/src/virtualenv/app_data/via_disk_folder.py @@ -137,7 +137,10 @@ class JSONStoreDisk(ContentStore): except Exception: # noqa pass if bad_format: - self.remove() + try: + self.remove() + except OSError: # reading and writing on the same file may cause race on multiple processes + pass return None def remove(self): |