Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/Orleans.Runtime/MembershipService/ClusterHealthMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ private async Task ProcessMembershipUpdates()
{
if (!newMonitoredSilos.ContainsKey(pair.Key))
{
var cancellation = new CancellationTokenSource(this.clusterMembershipOptions.CurrentValue.ProbeTimeout).Token;
await pair.Value.StopAsync(cancellation);
using var cancellation = new CancellationTokenSource(this.clusterMembershipOptions.CurrentValue.ProbeTimeout);
await pair.Value.StopAsync(cancellation.Token);
}
}

Expand Down
12 changes: 10 additions & 2 deletions src/Orleans.Runtime/MembershipService/SiloHealthMonitor.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#nullable enable
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
Expand Down Expand Up @@ -124,7 +125,7 @@ public async Task StopAsync(CancellationToken cancellationToken)

if (_runTask is Task task)
{
await task.WaitAsync(cancellationToken).ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
await task.WaitAsync(cancellationToken).SuppressThrowing();
}
}

Expand All @@ -147,7 +148,7 @@ public async ValueTask DisposeAsync()
Dispose();
if (_runTask is Task task)
{
await task.ConfigureAwait(ConfigureAwaitOptions.SuppressThrowing);
await task.SuppressThrowing();
}
}

Expand Down Expand Up @@ -236,6 +237,13 @@ TimeSpan GetTimeout(bool isDirectProbe)
additionalTimeout += 1;
}

// When the debugger is attached, extend probe times so that silos are not terminated
// due to debugging pauses.
if (Debugger.IsAttached)
{
additionalTimeout += 25;
}

return options.ProbeTimeout.Multiply(1 + additionalTimeout);
}
}
Expand Down
15 changes: 5 additions & 10 deletions src/Orleans.Runtime/Scheduler/WorkItemGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,14 @@ private void LogTaskLoopError(Exception ex)
Thread.CurrentThread.ManagedThreadId);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private void LogTaskRunError(Task task, Exception ex)
{
_log.LogError(
(int)ErrorCode.SchedulerExceptionFromExecute,
ex,
"Worker thread caught an exception thrown from Execute by task {Task}",
task);
}

[MethodImpl(MethodImplOptions.NoInlining)]
private void LogLongRunningTurn(Task task, long taskDurationMs)
{
if (Debugger.IsAttached)
{
return;
}

var taskDuration = TimeSpan.FromMilliseconds(taskDurationMs);
_log.LogWarning(
(int)ErrorCode.SchedulerTurnTooLong3,
Expand Down
11 changes: 10 additions & 1 deletion src/Orleans.Runtime/Silo/Watchdog.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable enable
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading;
Expand Down Expand Up @@ -96,6 +97,11 @@ protected void RunPlatformWatchdog()

private void CheckRuntimeHealth()
{
if (Debugger.IsAttached)
{
return;
}

var pauseDurationSinceLastTick = GC.GetTotalPauseDuration() - _cumulativeGCPauseDuration;
var timeSinceLastTick = _platformWatchdogStopwatch.Elapsed;
if (timeSinceLastTick > PlatformWatchdogHeartbeatPeriod.Multiply(2))
Expand Down Expand Up @@ -178,7 +184,10 @@ private void CheckComponentHealth()
if (complaints != null)
{
WatchdogInstruments.FailedHealthChecks.Add(1);
_logger.LogWarning((int)ErrorCode.Watchdog_HealthCheckFailure, "{FailedChecks} of {ParticipantCount} components reported issues. Complaints: {Complaints}", numFailedChecks, _participants.Count, complaints);
if (!Debugger.IsAttached)
{
_logger.LogWarning((int)ErrorCode.Watchdog_HealthCheckFailure, "{FailedChecks} of {ParticipantCount} components reported issues. Complaints: {Complaints}", numFailedChecks, _participants.Count, complaints);
}
}

_lastComponentHealthCheckTime = DateTime.UtcNow;
Expand Down
16 changes: 10 additions & 6 deletions src/Orleans.Runtime/Timers/AsyncTimer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -76,11 +77,14 @@ public async Task<bool> NextTick(TimeSpan? overrideDelay = default)
var overshoot = GetOvershootDelay(now, dueTime);
if (overshoot > TimeSpan.Zero)
{
this.log?.LogWarning(
"Timer should have fired at {DueTime} but fired at {CurrentTime}, which is {Overshoot} longer than expected",
dueTime,
now,
overshoot);
if (!Debugger.IsAttached)
{
this.log?.LogWarning(
"Timer should have fired at {DueTime} but fired at {CurrentTime}, which is {Overshoot} longer than expected",
dueTime,
now,
overshoot);
}
}

expected = default;
Expand All @@ -103,7 +107,7 @@ public bool CheckHealth(DateTime lastCheckTime, out string reason)
var now = DateTime.UtcNow;
var due = this.expected;
var overshoot = GetOvershootDelay(now, due);
if (overshoot > TimeSpan.Zero)
if (overshoot > TimeSpan.Zero && !Debugger.IsAttached)
{
reason = $"{this.name} timer should have fired at {due}, which is {overshoot} ago";
return false;
Expand Down
Loading