Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 9 additions & 28 deletions src/TraceEvent/Symbols/SymbolReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,11 @@ public SymbolReaderOptions Options
}
private SymbolReaderOptions _Options;

/// <summary>
/// Gets or sets the timeout for symbol server requests. Default is 60 seconds.
/// </summary>
public TimeSpan ServerTimeout { get; set; } = TimeSpan.FromSeconds(60);

/// <summary>
/// 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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = (int)(ServerTimeout.TotalSeconds * 10); // Convert seconds to deciseconds (0.1 seconds)

for (int i = 0; i < limit; i++)
{
Expand Down Expand Up @@ -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<string>();
}

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, ServerTimeout.TotalSeconds, serverPath);
}
}
finally
Expand Down Expand Up @@ -1699,8 +1682,6 @@ private struct R2RPerfMapSignature : IEquatable<R2RPerfMapSignature>
}

internal TextWriter m_log;
private List<string> 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<string, ManagedSymbolModule> m_symbolModuleCache;
Expand Down