Skip to content

Commit 8b9dd95

Browse files
committed
[Serialization] Add more context to why we load swiftmodule files as volatile
1 parent 1733014 commit 8b9dd95

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

lib/Serialization/SerializedModuleLoader.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,16 @@ std::error_code SerializedModuleLoaderBase::openModuleFile(
341341
// Use the default arguments except for IsVolatile. Force avoiding the use of
342342
// mmap to workaround issues on NFS when the swiftmodule file loaded changes
343343
// on disk while it's in use.
344+
//
345+
// In practice, a swiftmodule file can chane when a client uses a
346+
// swiftmodule file from a framework while the framework is recompiled and
347+
// installed over existing files. Or when many processes rebuild the same
348+
// module interface.
349+
//
350+
// We have seen these scenarios leading to deserialization errors that on
351+
// the surface look like memory corruption.
352+
//
353+
// rdar://63755989
344354
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> ModuleOrErr =
345355
FS.getBufferForFile(ModulePath,
346356
/*FileSize=*/-1,

0 commit comments

Comments
 (0)