From 1418574894c5ba67d886908d909096b1b24fd648 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 May 2025 01:35:34 +0000 Subject: [PATCH 1/3] Initial plan for issue From 4db525672cb85ffadbbf9ae8fa8f0b46bb92bb37 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 May 2025 01:38:36 +0000 Subject: [PATCH 2/3] Make symbol server timeout configurable Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com> --- src/TraceEvent/Symbols/SymbolReader.cs | 37 +++++++------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/src/TraceEvent/Symbols/SymbolReader.cs b/src/TraceEvent/Symbols/SymbolReader.cs index f801e354f..03e2c324a 100644 --- a/src/TraceEvent/Symbols/SymbolReader.cs +++ b/src/TraceEvent/Symbols/SymbolReader.cs @@ -588,6 +588,11 @@ public SymbolReaderOptions Options } private SymbolReaderOptions _Options; + /// + /// Gets or sets the timeout in seconds for symbol server requests. Default is 60 seconds. + /// + public int ServerTimeoutSeconds { get; set; } = 60; + /// /// We call back on this when we find a PDB by probing in 'unsafe' locations (like next to the EXE or in the Built location) /// If this function returns true, we assume that it is OK to use the PDB. @@ -1122,21 +1127,6 @@ internal bool GetPhysicalFileFromServer(string serverPath, string pdbIndexPath, var sw = Stopwatch.StartNew(); - if (m_deadServers != null) - { - // Try again after 5 minutes. - if ((DateTime.UtcNow - m_lastDeadTimeUtc).TotalSeconds > 300) - { - m_deadServers = null; - } - } - - if (m_deadServers != null && m_deadServers.Contains(serverPath)) - { - m_log.WriteLine("FindSymbolFilePath: Skipping server {0} because it was unreachable in the past, will try again in 5 min.", serverPath); - return false; - } - bool canceled = false; // Are we trying to cancel the task bool alive = false; // Has the task ever been shown to be alive (worth giving them time) bool successful = false; // The task was successful @@ -1220,8 +1210,8 @@ internal bool GetPhysicalFileFromServer(string serverPath, string pdbIndexPath, } }); - // Wait 60 seconds allowing for interruptions. - var limit = 600; + // Wait for the timeout period allowing for interruptions. + var limit = ServerTimeoutSeconds * 10; // Convert seconds to deciseconds (0.1 seconds) for (int i = 0; i < limit; i++) { @@ -1255,15 +1245,8 @@ internal bool GetPhysicalFileFromServer(string serverPath, string pdbIndexPath, else if (!task.IsCompleted) { canceled = true; - m_log.WriteLine("FindSymbolFilePath: Time {0} sec. Timeout of {1} seconds exceeded for {2}. Setting as dead server", - sw.Elapsed.TotalSeconds, limit / 10, serverPath); - if (m_deadServers == null) - { - m_deadServers = new List(); - } - - m_deadServers.Add(serverPath); - m_lastDeadTimeUtc = DateTime.UtcNow; + m_log.WriteLine("FindSymbolFilePath: Time {0} sec. Timeout of {1} seconds exceeded for {2}.", + sw.Elapsed.TotalSeconds, ServerTimeoutSeconds, serverPath); } } finally @@ -1699,8 +1682,6 @@ private struct R2RPerfMapSignature : IEquatable } internal TextWriter m_log; - private List m_deadServers; // What servers can't be reached right now - private DateTime m_lastDeadTimeUtc; // The last time something went dead. private string m_SymbolCacheDirectory; private string m_SourceCacheDirectory; private Cache m_symbolModuleCache; From c7f656e1cca2d57cab1c383c855dbf0e58aa52ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 23 May 2025 02:12:52 +0000 Subject: [PATCH 3/3] Change ServerTimeoutSeconds to ServerTimeout TimeSpan property Co-authored-by: brianrob <6210322+brianrob@users.noreply.github.com> --- src/TraceEvent/Symbols/SymbolReader.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/TraceEvent/Symbols/SymbolReader.cs b/src/TraceEvent/Symbols/SymbolReader.cs index 03e2c324a..59a2a3e73 100644 --- a/src/TraceEvent/Symbols/SymbolReader.cs +++ b/src/TraceEvent/Symbols/SymbolReader.cs @@ -589,9 +589,9 @@ public SymbolReaderOptions Options private SymbolReaderOptions _Options; /// - /// Gets or sets the timeout in seconds for symbol server requests. Default is 60 seconds. + /// Gets or sets the timeout for symbol server requests. Default is 60 seconds. /// - public int ServerTimeoutSeconds { get; set; } = 60; + public TimeSpan ServerTimeout { get; set; } = TimeSpan.FromSeconds(60); /// /// We call back on this when we find a PDB by probing in 'unsafe' locations (like next to the EXE or in the Built location) @@ -1211,7 +1211,7 @@ internal bool GetPhysicalFileFromServer(string serverPath, string pdbIndexPath, }); // Wait for the timeout period allowing for interruptions. - var limit = ServerTimeoutSeconds * 10; // Convert seconds to deciseconds (0.1 seconds) + var limit = (int)(ServerTimeout.TotalSeconds * 10); // Convert seconds to deciseconds (0.1 seconds) for (int i = 0; i < limit; i++) { @@ -1246,7 +1246,7 @@ internal bool GetPhysicalFileFromServer(string serverPath, string pdbIndexPath, { canceled = true; m_log.WriteLine("FindSymbolFilePath: Time {0} sec. Timeout of {1} seconds exceeded for {2}.", - sw.Elapsed.TotalSeconds, ServerTimeoutSeconds, serverPath); + sw.Elapsed.TotalSeconds, ServerTimeout.TotalSeconds, serverPath); } } finally