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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#nullable enable
using System;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
Expand Down Expand Up @@ -53,7 +54,8 @@ private async Task ProcessPendingEdges(CancellationToken cancellationToken)
{
foreach (var message in drainBuffer[..count])
{
if (!_messageFilter.IsAcceptable(message, out var isSenderMigratable, out var isTargetMigratable))
if (!IsFullyAddressed(message) || // The silo addresses (likely the target) is set null some time later (after the message is recorded), this can lead to a NRE
!_messageFilter.IsAcceptable(message, out var isSenderMigratable, out var isTargetMigratable))
{
continue;
}
Expand Down Expand Up @@ -118,7 +120,7 @@ private void RecordMessage(Message message)
}

// Sender and target need to be fully addressable to know where to move to or towards.
if (!message.IsSenderFullyAddressed || !message.IsTargetFullyAddressed)
if (!IsFullyAddressed(message))
{
return;
}
Expand All @@ -129,6 +131,10 @@ private void RecordMessage(Message message)
}
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
private static bool IsFullyAddressed(Message message) =>
message.IsSenderFullyAddressed && message.IsTargetFullyAddressed;

async ValueTask IActivationRepartitionerSystemTarget.FlushBuffers()
{
while (_pendingMessages.Count > 0)
Expand All @@ -148,4 +154,4 @@ async ValueTask IActivationRepartitionerSystemTarget.FlushBuffers()
Message = "{Service} has stopped."
)]
private static partial void LogTraceServiceStopped(ILogger logger, string service);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ public bool IsAcceptable(Message message, out bool isSenderMigratable, out bool
// If both are not migratable types we ignore this. But if one of them is not, then we allow passing, as we wish to move grains closer to them, as with any type of grain.
return isSenderMigratable || isTargetMigratable;
}
}
}