<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 24, 2015, at 6:57 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk" class="">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 9, 2015 at 12:35 PM, Ben Langmuir<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:blangmuir@apple.com" target="_blank" class="">blangmuir@apple.com</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Author: benlangmuir<br class="">Date: Mon Feb  9 14:35:13 2015<br class="">New Revision: 228604<br class=""><br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=228604&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=228604&view=rev</a><br class="">Log:<br class="">Diagnose timeouts in the LockFileManager and delete the dead lock file<br class=""><br class="">If the lock file manager times out, we should give an error rather than<br class="">silently trying to load the existing module.  And delete the<br class="">(presumably) dead lock file, since it will otherwise prevent progress in<br class="">future invokations. This is unsound since we have no way to prove that<br class="">the lock file we are deleting is the same one we timed out on, but since<br class="">the lock is only to avoid excessive rebuilding anyway it should be okay.<br class="">Depends on llvm r228603.<br class=""></blockquote><div class=""><br class=""></div><div class="">This diagnostic fires a *lot* when, say, bootstrapping Clang with modules enabled at -j16. Is the timeout perhaps too short?</div></div></div></div></div></blockquote><div><br class=""></div>I lowered the timeout to 1 minute in my llvm commit, so if it helps, feel free to bump it back up.  I’m not particularly concerned about the actual number now that we will actually honour the limit, but the old value of 5 minutes seemed really long to me.</div><div><br class=""></div><div>Ben</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;">Modified:<br class="">   <span class="Apple-converted-space"> </span>cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td<br class="">   <span class="Apple-converted-space"> </span>cfe/trunk/lib/Frontend/CompilerInstance.cpp<br class=""><br class="">Modified: cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=228604&r1=228603&r2=228604&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td?rev=228604&r1=228603&r2=228604&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td (original)<br class="">+++ cfe/trunk/include/clang/Basic/DiagnosticCommonKinds.td Mon Feb  9 14:35:13 2015<br class="">@@ -83,6 +83,8 @@ def err_module_not_found : Error<"module<br class=""> def err_module_not_built : Error<"could not build module '%0'">, DefaultFatal;<br class=""> def err_module_lock_failure : Error<<br class="">   "could not acquire lock file for module '%0'">, DefaultFatal;<br class="">+def err_module_lock_timeout : Error<<br class="">+  "timed out waiting to acquire lock file for module '%0'">, DefaultFatal;<br class=""> def err_module_cycle : Error<"cyclic dependency in module '%0': %1">,<br class="">   DefaultFatal;<br class=""> def note_pragma_entered_here : Note<"#pragma entered here">;<br class=""><br class="">Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp<br class="">URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=228604&r1=228603&r2=228604&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=228604&r1=228603&r2=228604&view=diff</a><br class="">==============================================================================<br class="">--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)<br class="">+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Feb  9 14:35:13 2015<br class="">@@ -1022,9 +1022,19 @@ static bool compileAndLoadModule(Compile<br class="">     case llvm::LockFileManager::LFS_Shared:<br class="">       // Someone else is responsible for building the module. Wait for them to<br class="">       // finish.<br class="">-      if (Locked.waitForUnlock() == llvm::LockFileManager::Res_OwnerDied)<br class="">+      switch (Locked.waitForUnlock()) {<br class="">+      case llvm::LockFileManager::Res_Success:<br class="">+        ModuleLoadCapabilities |= ASTReader::ARR_OutOfDate;<br class="">+        break;<br class="">+      case llvm::LockFileManager::Res_OwnerDied:<br class="">         continue; // try again to get the lock.<br class="">-      ModuleLoadCapabilities |= ASTReader::ARR_OutOfDate;<br class="">+      case llvm::LockFileManager::Res_Timeout:<br class="">+        Diags.Report(ModuleNameLoc, diag::err_module_lock_timeout)<br class="">+            << Module->Name;<br class="">+        // Clear the lock file so that future invokations can make progress.<br class="">+        Locked.unsafeRemoveLockFile();<br class="">+        return false;<br class="">+      }<br class="">       break;<br class="">     }<br class=""><br class=""><br class=""><br class="">_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@cs.uiuc.edu" class="">cfe-commits@cs.uiuc.edu</a><br class=""><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></blockquote></div></div></div></div></blockquote></div><br class=""></body></html>