Skip to content

Commit 2f7f7df

Browse files
committed
Suppress host restart for race condition case where hostingstart.html change evaluates to a host restart
1 parent fa7631a commit 2f7f7df

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/WebJobs.Script/Host/ScriptHost.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,6 +1624,16 @@ private void OnFileChanged(FileSystemEventArgs e)
16241624
string.Compare(fileName, ScriptConstants.ProxyMetadataFileName, StringComparison.OrdinalIgnoreCase) == 0) ||
16251625
!_directorySnapshot.SequenceEqual(Directory.EnumerateDirectories(ScriptConfig.RootScriptPath)))
16261626
{
1627+
// CRI ICM: 46695121
1628+
// Do not allow the host to restart if this notification is for the hostingstart.html file in the root
1629+
if (string.Compare(directory, "hostingstart.html", StringComparison.OrdinalIgnoreCase) == 0)
1630+
{
1631+
string hostingWarning = string.Format(CultureInfo.InvariantCulture, "Unexpected file change event detected for '{0}' which evaluated to a host restart. Suppressing restart.", e.FullPath);
1632+
TraceWriter.Warning(hostingWarning);
1633+
Logger?.LogWarning(hostingWarning);
1634+
return;
1635+
}
1636+
16271637
bool shutdown = false;
16281638
string fileExtension = Path.GetExtension(fileName);
16291639
if (!string.IsNullOrEmpty(fileExtension) && ScriptConstants.AssemblyFileTypes.Contains(fileExtension, StringComparer.OrdinalIgnoreCase))

0 commit comments

Comments
 (0)