Update createdumpwindows to not appear to succeed after getting ERROR_PARTIAL_COPY...
authorAndrew Moskevitz <49752377+Applesauce314@users.noreply.github.com>
Mon, 22 May 2023 16:09:07 +0000 (12:09 -0400)
committerGitHub <noreply@github.com>
Mon, 22 May 2023 16:09:07 +0000 (09:09 -0700)
* Update createdumpwindows.cpp

create dump has same bug as documented and fixed in dotnet-dump (https://github.com/dotnet/diagnostics/issues/3829)

* Update createdumpwindows.cpp

changed retry count to 10 to match dotnet-dump

src/coreclr/debug/createdump/createdumpwindows.cpp

index 759ec3c..d1b843f 100644 (file)
@@ -63,9 +63,10 @@ CreateDump(const CreateDumpOptions& options)
         printf_error("Invalid dump path '%s' - %s\n", dumpPath.c_str(), GetLastErrorString().c_str());
         goto exit;
     }
-
+    
+    int retryCount = 10;
     // Retry the write dump on ERROR_PARTIAL_COPY
-    for (int i = 0; i < 5; i++)
+    for (int i = 0; i <= retryCount; i++)
     {
         if (MiniDumpWriteDump(hProcess, pid, hFile, GetMiniDumpType(options.DumpType), NULL, NULL, NULL))
         {
@@ -75,11 +76,15 @@ CreateDump(const CreateDumpOptions& options)
         else
         {
             int err = GetLastError();
-            if (err != ERROR_PARTIAL_COPY)
+            if (err != ERROR_PARTIAL_COPY || i == retryCount)
             {
                 printf_error("MiniDumpWriteDump - %s\n", GetLastErrorString().c_str());
                 break;
             }
+            else
+            {
+                 printf_error("Retry %d of MiniDumpWriteDump due to - %s\n", i, GetLastErrorString().c_str());
+            }
         }
     }